From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- ..._quantized_lstm_end_to_end_test_impl_8cpp.xhtml | 171 +++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 21.02/_quantized_lstm_end_to_end_test_impl_8cpp.xhtml (limited to '21.02/_quantized_lstm_end_to_end_test_impl_8cpp.xhtml') diff --git a/21.02/_quantized_lstm_end_to_end_test_impl_8cpp.xhtml b/21.02/_quantized_lstm_end_to_end_test_impl_8cpp.xhtml new file mode 100644 index 0000000000..6897e6c1aa --- /dev/null +++ b/21.02/_quantized_lstm_end_to_end_test_impl_8cpp.xhtml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + +ArmNN: src/backends/backendsCommon/test/QuantizedLstmEndToEndTestImpl.cpp File Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
QuantizedLstmEndToEndTestImpl.cpp File Reference
+
+
+
#include "QuantizedLstmEndToEndTestImpl.hpp"
+#include "CommonTestUtils.hpp"
+#include "EndToEndTestImpl.hpp"
+#include <ResolveType.hpp>
+#include <armnn/INetwork.hpp>
+#include <armnn/QuantizedLstmParams.hpp>
+#include <armnn/utility/NumericCast.hpp>
+#include <test/TensorHelpers.hpp>
+#include <boost/test/unit_test.hpp>
+#include <type_traits>
+
+

Go to the source code of this file.

+ + + + +

+Functions

void QuantizedLstmEndToEnd (const std::vector< armnn::BackendId > &backends)
 
+

Function Documentation

+ +

◆ QuantizedLstmEndToEnd()

+ +
+
+ + + + + + + + +
void QuantizedLstmEndToEnd (const std::vector< armnn::BackendId > & backends)
+
+ +

Definition at line 181 of file QuantizedLstmEndToEndTestImpl.cpp.

+ +

References armnn::Optimize(), armnn::QAsymmU8, and armnn::QSymmS16.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
182 {
183  std::vector<uint8_t> inputVector = {166, 179, 50, 150};
184  armnn::TensorInfo inputDesc({2, 2}, armnn::DataType::QAsymmU8);
185  boost::multi_array<uint8_t, 2> input = MakeTensor<uint8_t, 2>(inputDesc, inputVector);
186 
187  std::vector<int16_t> cellStateInVector = {876, 1034, 955, -909, 761, 1029, 796, -1036};
188  armnn::TensorInfo cellStateInDesc({2, 4}, armnn::DataType::QSymmS16);
189  boost::multi_array<int16_t, 2> cellStateIn = MakeTensor<int16_t, 2>(cellStateInDesc, cellStateInVector);
190 
191  std::vector<uint8_t> outputStateInVector = {136, 150, 140, 115, 135, 152, 138, 112};
192  armnn::TensorInfo outputStateInDesc({2, 4}, armnn::DataType::QAsymmU8);
193  boost::multi_array<uint8_t, 2> outputStateIn = MakeTensor<uint8_t, 2>(outputStateInDesc, outputStateInVector);
194 
195  std::vector<int16_t> cellStateOutVector = {1485, 1177, 1373, -1023, 1019, 1355, 1097, -1235};
196  armnn::TensorInfo cellStateOutVectorDesc({2, 4}, armnn::DataType::QSymmS16);
197  boost::multi_array<int16_t, 2> cellStateOut = MakeTensor<int16_t, 2>(cellStateOutVectorDesc, cellStateOutVector);
198 
199  std::vector<uint8_t> outputStateOutVector = {140, 151, 146, 112, 136, 156, 142, 112};
200  armnn::TensorInfo outputDesc({2, 4}, armnn::DataType::QAsymmU8);
201  boost::multi_array<uint8_t, 2> outputStateOut = MakeTensor<uint8_t, 2>(outputDesc, outputStateOutVector);
202 
203  // Builds up the structure of the network
204  armnn::INetworkPtr net = CreateQuantizedLstmNetwork(input, outputStateOut);
205 
206  BOOST_TEST_CHECKPOINT("create a network");
207 
209  IRuntimePtr runtime(IRuntime::Create(options));
210 
211  // optimize the network
212  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
213 
214  // Loads it into the runtime.
215  NetworkId netId;
216  runtime->LoadNetwork(netId, std::move(optNet));
217 
218  InputTensors inputTensors;
219  inputTensors.reserve(3);
220 
221  // input
222  inputTensors.push_back({0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputVector.data())});
223  inputTensors.push_back({1, ConstTensor(runtime->GetInputTensorInfo(netId, 1), cellStateInVector.data())});
224  inputTensors.push_back({2, ConstTensor(runtime->GetInputTensorInfo(netId, 2), outputStateInVector.data())});
225 
226  OutputTensors outputTensors;
227  outputTensors.reserve(2);
228 
229  //output
230  std::vector<int16_t > cellStateOutResult(cellStateOutVector.size());
231  std::vector<uint8_t > outputStateOutResult(outputStateOutVector.size());
232  outputTensors.push_back({0, Tensor(runtime->GetOutputTensorInfo(netId, 0), cellStateOutResult.data())});
233  outputTensors.push_back({1, Tensor(runtime->GetOutputTensorInfo(netId, 1), outputStateOutResult.data())});
234 
235  // Does the inference.
236  runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
237 
238  // Checks the results
239  constexpr int16_t toleranceInt16 = 2;
240  for (unsigned int i = 0u; i < cellStateOutResult.size(); ++i)
241  {
242  BOOST_CHECK(IsCloseEnough(cellStateOutVector[i], cellStateOutResult[i], toleranceInt16));
243  }
244 
245  constexpr uint8_t toleranceUint8 = 1;
246  for (unsigned int i = 0u; i < outputStateOutResult.size(); ++i)
247  {
248  BOOST_TEST(IsCloseEnough(outputStateOutVector[i], outputStateOutResult[i], toleranceUint8));
249  }
250 }
+
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
+
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:340
+ +
int NetworkId
Definition: IRuntime.hpp:20
+
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:306
+
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
Definition: Network.cpp:1502
+ +
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:314
+
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
Definition: Tensor.hpp:341
+
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
+ +
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
+
+
+
+
+
+ + + + -- cgit v1.2.1