21 #include <boost/test/unit_test.hpp> 22 #include <boost/cast.hpp> 26 using namespace armnn;
34 template<
typename Workload>
37 std::unique_ptr<IWorkload> workload = layer.
CreateWorkload(factory);
38 BOOST_TEST(workload.get() == PolymorphicDowncast<Workload*>(workload.get()),
39 "Cannot convert to derived class");
40 std::string reasonIfUnsupported;
43 return std::unique_ptr<Workload>(
static_cast<Workload*
>(workload.release()));
64 template <
typename ActivationWorkload, armnn::DataType DataType>
72 layerDesc.
m_B = -10.0f;
83 Connect(input, layer, tensorInfo);
84 Connect(layer, output, tensorInfo);
86 CreateTensorHandles(graph, factory);
89 auto workload = MakeAndCheckWorkload<ActivationWorkload>(*layer, factory);
92 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
93 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
94 BOOST_TEST(queueDescriptor.m_Parameters.m_A == 3.5f);
95 BOOST_TEST(queueDescriptor.m_Parameters.m_B == -10.0f);
102 template <
typename WorkloadType,
103 typename DescriptorType,
119 Connect(input1, layer, tensorInfo, 0, 0);
120 Connect(input2, layer, tensorInfo, 0, 1);
121 Connect(layer, output, tensorInfo);
122 CreateTensorHandles(graph, factory);
125 auto workload = MakeAndCheckWorkload<WorkloadType>(*layer, factory);
127 DescriptorType queueDescriptor = workload->GetData();
128 BOOST_TEST(queueDescriptor.m_Inputs.size() == 2);
129 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
135 template <
typename WorkloadType,
136 typename DescriptorType,
149 Connect(input, layer, tensorInfo, 0, 0);
150 Connect(layer, output, tensorInfo, 0, 0);
151 CreateTensorHandles(graph, factory);
153 auto workload = MakeAndCheckWorkload<WorkloadType>(*layer, factory);
154 DescriptorType queueDescriptor = workload->GetData();
156 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
157 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
162 template <
typename BatchNormalizationWorkloadType, armnn::DataType DataType>
163 std::unique_ptr<BatchNormalizationWorkloadType> CreateBatchNormalizationWorkloadTest(
170 tensorShape = { 2, 4, 4, 3 };
174 tensorShape = { 2, 3, 4, 4 };
179 layerDesc.
m_Eps = 0.05f;
185 layer->
m_Mean = std::make_unique<ScopedCpuTensorHandle>(weightInfo);
186 layer->
m_Variance = std::make_unique<ScopedCpuTensorHandle>(weightInfo);
187 layer->
m_Beta = std::make_unique<ScopedCpuTensorHandle>(weightInfo);
188 layer->
m_Gamma = std::make_unique<ScopedCpuTensorHandle>(weightInfo);
189 layer->
m_Mean->Allocate();
191 layer->
m_Beta->Allocate();
200 Connect(input, layer, tensorInfo);
201 Connect(layer, output, tensorInfo);
202 CreateTensorHandles(graph, factory);
205 auto workload = MakeAndCheckWorkload<BatchNormalizationWorkloadType>(*layer, factory);
207 BOOST_TEST(queueDescriptor.m_Parameters.m_Eps == 0.05f);
208 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
209 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
211 BOOST_TEST((queueDescriptor.m_Variance->GetTensorInfo() ==
TensorInfo({3},
DataType)));
214 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
220 template <
typename Convolution2dWorkload, armnn::DataType DataType>
246 layer->
m_Bias->Allocate();
255 CreateTensorHandles(graph, factory);
258 auto workload = MakeAndCheckWorkload<Convolution2dWorkload>(*layer, factory);
261 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideX == 2);
262 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideY == 4);
263 BOOST_TEST(queueDescriptor.m_Parameters.m_PadLeft == 3);
264 BOOST_TEST(queueDescriptor.m_Parameters.m_PadRight == 3);
265 BOOST_TEST(queueDescriptor.m_Parameters.m_PadTop == 1);
266 BOOST_TEST(queueDescriptor.m_Parameters.m_PadBottom == 1);
267 BOOST_TEST(queueDescriptor.m_Parameters.m_BiasEnabled);
268 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
270 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
271 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
272 BOOST_TEST((queueDescriptor.m_Weight->GetTensorInfo() ==
TensorInfo(weightShape,
DataType)));
273 BOOST_TEST((queueDescriptor.m_Bias->GetTensorInfo() ==
280 template <
typename LstmWorkload>
293 unsigned int batchSize = 2;
294 unsigned int inputSize = 2;
295 unsigned int numUnits = 4;
296 unsigned int outputSize = 4;
328 if (layerDesc.m_PeepholeEnabled)
351 armnn::TensorInfo lstmTensorInfoScratchBuff({ batchSize, numUnits * (layerDesc.m_CifgEnabled ? 3 : 4) },
353 Connect(input, layer, lstmTensorInfo1, 0, 0);
354 Connect(cellStateIn, layer, lstmTensorInfo2, 0, 1);
355 Connect(outputStateIn, layer, lstmTensorInfo3, 0, 2);
356 Connect(layer, scratchBuffer, lstmTensorInfoScratchBuff, 0, 0);
357 Connect(layer, outputStateOut, lstmTensorInfo3, 1, 0);
358 Connect(layer, cellStateOut, lstmTensorInfo2, 2, 0);
359 Connect(layer, output, lstmTensorInfo3, 3, 0);
361 CreateTensorHandles(graph, factory);
364 auto workload = MakeAndCheckWorkload<LstmWorkload>(*layer, factory);
366 BOOST_TEST(queueDescriptor.m_Parameters.m_ActivationFunc == 4);
367 BOOST_TEST(queueDescriptor.m_Parameters.m_ClippingThresCell == 0.0f);
368 BOOST_TEST(queueDescriptor.m_Parameters.m_ClippingThresProj == 0.0f);
369 BOOST_TEST(queueDescriptor.m_Inputs.size() == 3);
370 BOOST_TEST(queueDescriptor.m_Outputs.size() == 4);
372 BOOST_TEST((queueDescriptor.m_InputToForgetWeights->GetTensorInfo() ==
TensorInfo({ numUnits, inputSize },
374 BOOST_TEST((queueDescriptor.m_OutputGateBias->GetTensorInfo() ==
TensorInfo({ numUnits },
380 template <
typename QuantizedLstmWorkload>
385 unsigned int numBatches = 2;
386 unsigned int inputSize = 2;
387 unsigned int outputSize = 4;
390 float inputOutputScale = 0.0078125f;
391 int32_t inputOutputOffset = 128;
393 float cellStateScale = 0.00048828125f;
394 int32_t cellStateOffset = 0;
396 float weightsScale = 0.00408021f;
397 int32_t weightsOffset = 100;
399 float biasScale = 3.1876640625e-05f;
400 int32_t biasOffset = 0;
419 layer->m_QuantizedLstmParameters.m_InputToInputWeights =
420 std::make_unique<ScopedCpuTensorHandle>(inputWeightsInfo);
421 layer->m_QuantizedLstmParameters.m_InputToForgetWeights =
422 std::make_unique<ScopedCpuTensorHandle>(inputWeightsInfo);
423 layer->m_QuantizedLstmParameters.m_InputToCellWeights =
424 std::make_unique<ScopedCpuTensorHandle>(inputWeightsInfo);
425 layer->m_QuantizedLstmParameters.m_InputToOutputWeights =
426 std::make_unique<ScopedCpuTensorHandle>(inputWeightsInfo);
428 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights =
429 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
430 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights =
431 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
432 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights =
433 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
434 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights =
435 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
437 layer->m_QuantizedLstmParameters.m_InputGateBias = std::make_unique<ScopedCpuTensorHandle>(biasInfo);
438 layer->m_QuantizedLstmParameters.m_ForgetGateBias = std::make_unique<ScopedCpuTensorHandle>(biasInfo);
439 layer->m_QuantizedLstmParameters.m_CellBias = std::make_unique<ScopedCpuTensorHandle>(biasInfo);
440 layer->m_QuantizedLstmParameters.m_OutputGateBias = std::make_unique<ScopedCpuTensorHandle>(biasInfo);
443 layer->m_QuantizedLstmParameters.m_InputToInputWeights->Allocate();
444 layer->m_QuantizedLstmParameters.m_InputToForgetWeights->Allocate();
445 layer->m_QuantizedLstmParameters.m_InputToCellWeights->Allocate();
446 layer->m_QuantizedLstmParameters.m_InputToOutputWeights->Allocate();
448 layer->m_QuantizedLstmParameters.m_RecurrentToInputWeights->Allocate();
449 layer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights->Allocate();
450 layer->m_QuantizedLstmParameters.m_RecurrentToCellWeights->Allocate();
451 layer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights->Allocate();
453 layer->m_QuantizedLstmParameters.m_InputGateBias->Allocate();
454 layer->m_QuantizedLstmParameters.m_ForgetGateBias->Allocate();
455 layer->m_QuantizedLstmParameters.m_CellBias->Allocate();
456 layer->m_QuantizedLstmParameters.m_OutputGateBias->Allocate();
483 Connect(input, layer, inputInfo, 0, 0);
484 Connect(cellStateIn, layer, cellStateInfo, 0, 1);
485 Connect(outputStateIn, layer, outputStateInfo, 0, 2);
487 Connect(layer, cellStateOut, cellStateInfo, 0, 0);
488 Connect(layer, outputStateOut, outputStateInfo, 1, 0);
490 CreateTensorHandles(graph, factory);
493 auto workload = MakeAndCheckWorkload<QuantizedLstmWorkload>(*layer, factory);
497 BOOST_TEST(queueDescriptor.m_Inputs.size() == 3);
498 BOOST_TEST(queueDescriptor.m_Outputs.size() == 2);
501 BOOST_TEST((queueDescriptor.m_InputToInputWeights->GetTensorInfo() == inputWeightsInfo));
502 BOOST_TEST((queueDescriptor.m_InputToForgetWeights->GetTensorInfo() == inputWeightsInfo));
503 BOOST_TEST((queueDescriptor.m_InputToCellWeights->GetTensorInfo() == inputWeightsInfo));
504 BOOST_TEST((queueDescriptor.m_InputToOutputWeights->GetTensorInfo() == inputWeightsInfo));
506 BOOST_TEST((queueDescriptor.m_RecurrentToInputWeights->GetTensorInfo() == recurrentWeightsInfo));
507 BOOST_TEST((queueDescriptor.m_RecurrentToForgetWeights->GetTensorInfo() == recurrentWeightsInfo));
508 BOOST_TEST((queueDescriptor.m_RecurrentToCellWeights->GetTensorInfo() == recurrentWeightsInfo));
509 BOOST_TEST((queueDescriptor.m_RecurrentToOutputWeights->GetTensorInfo() == recurrentWeightsInfo));
511 BOOST_TEST((queueDescriptor.m_InputGateBias->GetTensorInfo() == biasInfo));
512 BOOST_TEST((queueDescriptor.m_ForgetGateBias->GetTensorInfo() == biasInfo));
513 BOOST_TEST((queueDescriptor.m_CellBias->GetTensorInfo() == biasInfo));
514 BOOST_TEST((queueDescriptor.m_OutputGateBias->GetTensorInfo() == biasInfo));
519 template <
typename QLstmWorkload>
542 unsigned int numBatches = 2;
543 unsigned int inputSize = 4;
544 unsigned int numUnits = 4;
545 unsigned int outputSize = 4;
548 float inputScale = 0.0078125f;
549 int32_t inputOffset = 0;
552 float outputScale = layerDesc.m_HiddenStateScale;
553 int32_t outputOffset = layerDesc.m_HiddenStateZeroPoint;
555 float cellStateScale = 3.05176e-05f;
556 int32_t cellStateOffset = 0;
558 float weightsScale = 0.00784314f;
559 int32_t weightsOffset = 0;
561 float layerNormScale = 3.05182e-05f;
562 int32_t layerNormOffset = 0;
564 float biasScale = layerNormScale / 1024;
565 int32_t biasOffset = 0;
588 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
590 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
592 std::make_unique<ScopedCpuTensorHandle>(recurrentWeightsInfo);
599 std::make_unique<ScopedCpuTensorHandle>(layerNormWeightsInfo);
601 std::make_unique<ScopedCpuTensorHandle>(layerNormWeightsInfo);
603 std::make_unique<ScopedCpuTensorHandle>(layerNormWeightsInfo);
647 Connect(input, layer, inputInfo, 0, 0);
648 Connect(outputStateIn, layer, outputStateInfo, 0, 1);
649 Connect(cellStateIn, layer, cellStateInfo, 0, 2);
651 Connect(layer, outputStateOut, outputStateInfo, 0, 0);
652 Connect(layer, cellStateOut, cellStateInfo, 1, 0);
653 Connect(layer, output, outputStateInfo, 2, 0);
655 CreateTensorHandles(graph, factory);
658 auto workload = MakeAndCheckWorkload<QLstmWorkload>(*layer, factory);
660 BOOST_TEST(queueDescriptor.m_Parameters.m_CellClip == 0.0f);
661 BOOST_TEST(queueDescriptor.m_Parameters.m_ProjectionClip == 0.0f);
662 BOOST_TEST(queueDescriptor.m_Inputs.size() == 3);
663 BOOST_TEST(queueDescriptor.m_Outputs.size() == 3);
665 BOOST_TEST((queueDescriptor.m_InputToForgetWeights->GetTensorInfo() == inputWeightsInfo));
666 BOOST_TEST((queueDescriptor.m_InputToCellWeights->GetTensorInfo() == inputWeightsInfo));
667 BOOST_TEST((queueDescriptor.m_InputToOutputWeights->GetTensorInfo() == inputWeightsInfo));
669 BOOST_TEST((queueDescriptor.m_RecurrentToForgetWeights->GetTensorInfo() == recurrentWeightsInfo));
670 BOOST_TEST((queueDescriptor.m_RecurrentToCellWeights->GetTensorInfo() == recurrentWeightsInfo));
671 BOOST_TEST((queueDescriptor.m_RecurrentToOutputWeights->GetTensorInfo() == recurrentWeightsInfo));
673 BOOST_TEST((queueDescriptor.m_ForgetGateBias->GetTensorInfo() == biasInfo));
674 BOOST_TEST((queueDescriptor.m_CellBias->GetTensorInfo() == biasInfo));
675 BOOST_TEST((queueDescriptor.m_OutputGateBias->GetTensorInfo() == biasInfo));
680 template <
typename Convolution2dWorkload, armnn::DataType DataType>
696 float inputsQScale =
DataType == armnn::DataType::QAsymmU8 ? 1.0f : 0.0;
697 float outputQScale =
DataType == armnn::DataType::QAsymmU8 ? 2.0f : 0.0;
700 layer->
m_Bias = std::make_unique<ScopedCpuTensorHandle>
703 layer->
m_Bias->Allocate();
712 CreateTensorHandles(graph, factory);
715 auto workload = MakeAndCheckWorkload<Convolution2dWorkload>(*layer, factory);
718 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideX == 1);
719 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideY == 1);
720 BOOST_TEST(queueDescriptor.m_Parameters.m_PadLeft == 1);
721 BOOST_TEST(queueDescriptor.m_Parameters.m_PadRight == 1);
722 BOOST_TEST(queueDescriptor.m_Parameters.m_PadTop == 1);
723 BOOST_TEST(queueDescriptor.m_Parameters.m_PadBottom == 1);
724 BOOST_TEST(queueDescriptor.m_Parameters.m_BiasEnabled ==
true);
726 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
727 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
728 BOOST_TEST((queueDescriptor.m_Weight->GetTensorInfo() ==
TensorInfo({2, 3, 3, 3},
730 BOOST_TEST((queueDescriptor.m_Bias->GetTensorInfo()
737 template <
typename DepthwiseConvolution2dFloat32Workload, armnn::DataType DataType>
738 std::unique_ptr<DepthwiseConvolution2dFloat32Workload> CreateDepthwiseConvolution2dWorkloadTest(
769 CreateTensorHandles(graph, factory);
772 auto workload = MakeAndCheckWorkload<DepthwiseConvolution2dFloat32Workload>(*layer, factory);
775 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideX == 1);
776 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideY == 1);
777 BOOST_TEST(queueDescriptor.m_Parameters.m_PadLeft == 1);
778 BOOST_TEST(queueDescriptor.m_Parameters.m_PadRight == 2);
779 BOOST_TEST(queueDescriptor.m_Parameters.m_PadTop == 1);
780 BOOST_TEST(queueDescriptor.m_Parameters.m_PadBottom == 2);
781 BOOST_TEST(queueDescriptor.m_Parameters.m_BiasEnabled ==
false);
782 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
784 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
785 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
786 BOOST_TEST((queueDescriptor.m_Weight->GetTensorInfo() ==
TensorInfo({1, 2, 4, 4},
DataType)));
792 template <
typename FullyConnectedWorkload, armnn::DataType DataType>
803 float inputsQScale =
DataType == armnn::DataType::QAsymmU8 ? 1.0f : 0.0;
804 float outputQScale =
DataType == armnn::DataType::QAsymmU8 ? 2.0f : 0.0;
809 layer->
m_Bias->Allocate();
818 CreateTensorHandles(graph, factory);
821 auto workload = MakeAndCheckWorkload<FullyConnectedWorkload>(*layer, factory);
824 BOOST_TEST(queueDescriptor.m_Parameters.m_BiasEnabled ==
true);
825 BOOST_TEST(queueDescriptor.m_Parameters.m_TransposeWeightMatrix ==
true);
827 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
828 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
829 BOOST_TEST((queueDescriptor.m_Weight->GetTensorInfo() ==
TensorInfo({7, 20},
DataType, inputsQScale)));
836 template <
typename NormalizationWorkload, armnn::DataType DataType>
848 layerDesc.
m_K = 0.2f;
865 Connect(input, layer, inputTensorInfo);
866 Connect(layer, output, outputTensorInfo);
867 CreateTensorHandles(graph, factory);
870 auto workload = MakeAndCheckWorkload<NormalizationWorkload>(*layer, factory);
875 BOOST_TEST(queueDescriptor.m_Parameters.m_NormSize == 3);
876 BOOST_TEST(queueDescriptor.m_Parameters.m_Alpha == 0.5f);
877 BOOST_TEST(queueDescriptor.m_Parameters.m_Beta == -1.0f);
878 BOOST_TEST(queueDescriptor.m_Parameters.m_K == 0.2f);
879 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
881 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
882 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
888 template <
typename Pooling2dWorkload, armnn::DataType DataType>
919 CreateTensorHandles(graph, factory);
922 auto workload = MakeAndCheckWorkload<Pooling2dWorkload>(*layer, factory);
927 BOOST_TEST(queueDescriptor.m_Parameters.m_PoolWidth == 3);
928 BOOST_TEST(queueDescriptor.m_Parameters.m_PoolHeight == 3);
929 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideX == 2);
930 BOOST_TEST(queueDescriptor.m_Parameters.m_StrideY == 3);
931 BOOST_TEST(queueDescriptor.m_Parameters.m_PadLeft == 2);
932 BOOST_TEST(queueDescriptor.m_Parameters.m_PadRight == 2);
933 BOOST_TEST(queueDescriptor.m_Parameters.m_PadTop == 1);
934 BOOST_TEST(queueDescriptor.m_Parameters.m_PadBottom == 1);
935 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
937 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
938 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
944 template <
typename SoftmaxWorkload, armnn::DataType DataType>
953 softmaxDescriptor.
m_Axis = 1;
963 if (
DataType == armnn::DataType::QAsymmU8)
966 tensorInfo.SetQuantizationScale(1.f / 256);
968 else if (
DataType == armnn::DataType::QAsymmS8)
970 tensorInfo.SetQuantizationOffset(-128);
971 tensorInfo.SetQuantizationScale(1.f / 256);
974 Connect(input, layer, tensorInfo);
975 Connect(layer, output, tensorInfo);
976 CreateTensorHandles(graph, factory);
979 auto workload = MakeAndCheckWorkload<SoftmaxWorkload>(*layer, factory);
982 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
983 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
989 template<
typename SplitterWorkload, armnn::DataType DataType>
990 std::unique_ptr<SplitterWorkload>
1001 layerDesc.SetViewOriginCoord(0, 0, 0);
1002 layerDesc.SetViewOriginCoord(1, 0, 1);
1003 layerDesc.SetViewOriginCoord(2, 0, 3);
1015 Connect(input, layer, tensorInfo);
1021 Connect(layer, output0, output0Info, 0, 0);
1022 Connect(layer, output1, output1Info, 1, 0);
1023 Connect(layer, output2, output2Info, 2, 0);
1025 CreateTensorHandles(graph, factory);
1028 auto workload = MakeAndCheckWorkload<SplitterWorkload>(*layer, factory);
1031 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1032 BOOST_TEST(queueDescriptor.m_Outputs.size() == 3);
1033 BOOST_TEST(queueDescriptor.m_ViewOrigins.size() == 3);
1035 BOOST_TEST(queueDescriptor.m_ViewOrigins[0].m_Origin[0] == 0);
1036 BOOST_TEST(queueDescriptor.m_ViewOrigins[1].m_Origin[0] == 1);
1037 BOOST_TEST(queueDescriptor.m_ViewOrigins[2].m_Origin[0] == 3);
1038 BOOST_TEST(queueDescriptor.m_ViewOrigins[0].m_Origin[1] == 0);
1039 BOOST_TEST(queueDescriptor.m_ViewOrigins[1].m_Origin[1] == 0);
1040 BOOST_TEST(queueDescriptor.m_ViewOrigins[2].m_Origin[1] == 0);
1041 BOOST_TEST(queueDescriptor.m_ViewOrigins[0].m_Origin[2] == 0);
1042 BOOST_TEST(queueDescriptor.m_ViewOrigins[1].m_Origin[2] == 0);
1043 BOOST_TEST(queueDescriptor.m_ViewOrigins[2].m_Origin[2] == 0);
1050 template<
typename SplitterWorkload,
typename ConcatWorkload, armnn::DataType DataType>
1051 std::pair<std::unique_ptr<SplitterWorkload>, std::unique_ptr<ConcatWorkload>>
1063 splitterViews.SetViewOriginCoord(0, 0, 0);
1064 splitterViews.SetViewOriginCoord(0, 1, 0);
1065 splitterViews.SetViewOriginCoord(0, 2, 0);
1066 splitterViews.SetViewOriginCoord(0, 3, 0);
1068 splitterViews.SetViewOriginCoord(1, 0, 0);
1069 splitterViews.SetViewOriginCoord(1, 1, 1);
1070 splitterViews.SetViewOriginCoord(1, 2, 0);
1071 splitterViews.SetViewOriginCoord(1, 3, 0);
1074 BOOST_TEST_CHECKPOINT(
"created splitter layer");
1077 concatViews.SetViewOriginCoord(0, 0, 0);
1078 concatViews.SetViewOriginCoord(0, 1, 1);
1079 concatViews.SetViewOriginCoord(0, 2, 0);
1080 concatViews.SetViewOriginCoord(0, 3, 0);
1082 concatViews.SetViewOriginCoord(1, 0, 0);
1083 concatViews.SetViewOriginCoord(1, 1, 0);
1084 concatViews.SetViewOriginCoord(1, 2, 0);
1085 concatViews.SetViewOriginCoord(1, 3, 0);
1088 BOOST_TEST_CHECKPOINT(
"created concat layer");
1093 Connect(input, splitter, inputTensorInfo, 0, 0);
1094 BOOST_TEST_CHECKPOINT(
"connect input to splitter");
1095 Connect(splitter, concat, splitTensorInfo1, 0, 1);
1096 BOOST_TEST_CHECKPOINT(
"connect splitter[0] to concat[1]");
1097 Connect(splitter, concat, splitTensorInfo2, 1, 0);
1098 BOOST_TEST_CHECKPOINT(
"connect splitter[1] to concat[0]");
1099 Connect(concat, output, inputTensorInfo, 0, 0);
1100 BOOST_TEST_CHECKPOINT(
"connect concat to output");
1102 CreateTensorHandles(graph, factory);
1103 BOOST_TEST_CHECKPOINT(
"created tensor handles");
1105 auto workloadSplitter = MakeAndCheckWorkload<SplitterWorkload>(*splitter, factory);
1106 BOOST_TEST_CHECKPOINT(
"created splitter workload");
1107 auto workloadConcat = MakeAndCheckWorkload<ConcatWorkload>(*concat, factory);
1108 BOOST_TEST_CHECKPOINT(
"created concat workload");
1110 return {std::move(workloadSplitter), std::move(workloadConcat)};
1116 template<
typename SplitterWorkload,
typename ActivationWorkload, armnn::DataType DataType>
1118 std::unique_ptr<SplitterWorkload>& wlSplitter,
1119 std::unique_ptr<ActivationWorkload>& wlActiv0_0,
1120 std::unique_ptr<ActivationWorkload>& wlActiv0_1,
1121 std::unique_ptr<ActivationWorkload>& wlActiv1_0,
1122 std::unique_ptr<ActivationWorkload>& wlActiv1_1)
1133 splitterViews.SetViewOriginCoord(0, 0, 0);
1134 splitterViews.SetViewOriginCoord(0, 1, 0);
1135 splitterViews.SetViewOriginCoord(0, 2, 0);
1136 splitterViews.SetViewOriginCoord(0, 3, 0);
1138 splitterViews.SetViewOriginCoord(1, 0, 0);
1139 splitterViews.SetViewOriginCoord(1, 1, 1);
1140 splitterViews.SetViewOriginCoord(1, 2, 0);
1141 splitterViews.SetViewOriginCoord(1, 3, 0);
1158 Connect(input, splitter, inputTensorInfo, 0, 0);
1159 Connect(splitter, activ0_0, splitTensorInfo1, 0, 0);
1160 Connect(splitter, activ0_1, splitTensorInfo1, 0, 0);
1162 Connect(splitter, activ1_0, splitTensorInfo2, 1, 0);
1163 Connect(splitter, activ1_1, splitTensorInfo2, 1, 0);
1165 Connect(activ0_0, output1, splitTensorInfo1, 0, 0);
1166 Connect(activ0_1, output2, splitTensorInfo1, 0, 0);
1167 Connect(activ1_0, output3, splitTensorInfo2, 0, 0);
1168 Connect(activ1_1, output4, splitTensorInfo2, 0, 0);
1170 CreateTensorHandles(graph, factory);
1172 auto workloadSplitter = MakeAndCheckWorkload<SplitterWorkload>(*splitter, factory);
1173 auto workloadActiv0_0 = MakeAndCheckWorkload<ActivationWorkload>(*activ0_0, factory);
1174 auto workloadActiv0_1 = MakeAndCheckWorkload<ActivationWorkload>(*activ0_1, factory);
1175 auto workloadActiv1_0 = MakeAndCheckWorkload<ActivationWorkload>(*activ1_0, factory);
1176 auto workloadActiv1_1 = MakeAndCheckWorkload<ActivationWorkload>(*activ1_1, factory);
1178 wlSplitter = std::move(workloadSplitter);
1179 wlActiv0_0 = std::move(workloadActiv0_0);
1180 wlActiv0_1 = std::move(workloadActiv0_1);
1181 wlActiv1_0 = std::move(workloadActiv1_0);
1182 wlActiv1_1 = std::move(workloadActiv1_1);
1185 template <
typename ResizeWorkload, armnn::DataType DataType>
1193 switch (dataLayout) {
1195 inputShape = { 2, 4, 4, 3 };
1196 outputShape = { 2, 2, 2, 3 };
1200 inputShape = { 2, 3, 4, 4 };
1201 outputShape = { 2, 3, 2, 2 };
1220 Connect(input, layer, inputTensorInfo);
1221 Connect(layer, output, outputTensorInfo);
1222 CreateTensorHandles(graph, factory);
1225 auto workload = MakeAndCheckWorkload<ResizeWorkload>(*layer, factory);
1227 auto queueDescriptor = workload->GetData();
1228 BOOST_CHECK(queueDescriptor.m_Inputs.size() == 1);
1229 BOOST_CHECK(queueDescriptor.m_Outputs.size() == 1);
1230 BOOST_CHECK(queueDescriptor.m_Parameters.m_DataLayout == dataLayout);
1236 template <
typename BatchToSpaceNdWorkload, armnn::DataType DataType>
1250 Connect(input, layer, tensorInfo);
1251 Connect(layer, output, tensorInfo);
1253 CreateTensorHandles(graph, factory);
1256 auto workload = MakeAndCheckWorkload<BatchToSpaceNdWorkload>(*layer, factory);
1259 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1260 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1265 template <
typename L2NormalizationWorkload, armnn::DataType DataType>
1287 Connect(input, layer, inputTensorInfo);
1288 Connect(layer, output, outputTensorInfo);
1289 CreateTensorHandles(graph, factory);
1292 auto workload = MakeAndCheckWorkload<L2NormalizationWorkload>(*layer, factory);
1295 BOOST_TEST((queueDescriptor.m_Parameters.m_DataLayout == dataLayout));
1296 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1297 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1303 template <
typename ReshapeWorkload, armnn::DataType DataType>
1320 Connect(input, layer, inputTensorInfo);
1321 Connect(layer, output, outputTensorInfo);
1322 CreateTensorHandles(graph, factory);
1325 auto workload = MakeAndCheckWorkload<ReshapeWorkload>(*layer, factory);
1328 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1329 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1335 template <
typename ConvertFp16ToFp32Float32Workload>
1336 std::unique_ptr<ConvertFp16ToFp32Float32Workload> CreateConvertFp16ToFp32WorkloadTest(
1349 Connect(input, layer, inputTensorInfo);
1350 Connect(layer, output, outputTensorInfo);
1351 CreateTensorHandles(graph, factory);
1354 auto workload = MakeAndCheckWorkload<ConvertFp16ToFp32Float32Workload>(*layer, factory);
1357 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1358 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1364 template <
typename ConvertFp32ToFp16Float16Workload>
1365 std::unique_ptr<ConvertFp32ToFp16Float16Workload> CreateConvertFp32ToFp16WorkloadTest(
1378 Connect(input, layer, inputTensorInfo);
1379 Connect(layer, output, outputTensorInfo);
1380 CreateTensorHandles(graph, factory);
1383 auto workload = MakeAndCheckWorkload<ConvertFp32ToFp16Float16Workload>(*layer, factory);
1386 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1387 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1393 template <
typename MeanWorkload, armnn::DataType DataType>
1409 Connect(input, layer, inputTensorInfo);
1410 Connect(layer, output, outputTensorInfo);
1411 CreateTensorHandles(graph, factory);
1414 auto workload = MakeAndCheckWorkload<MeanWorkload>(*layer, factory);
1417 BOOST_TEST(queueDescriptor.m_Parameters.m_Axis == descriptor.m_Axis);
1418 BOOST_TEST(queueDescriptor.m_Parameters.m_KeepDims == descriptor.m_KeepDims);
1419 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1420 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1426 template<
typename ConcatWorkload, armnn::DataType DataType>
1430 unsigned int concatAxis)
1440 std::vector<armnn::TensorShape> inputShapes{{ 2, 3, 2, 5 }, { 2, 3, 2, 5 }};
1447 BOOST_TEST_CHECKPOINT(
"created concat layer");
1452 Connect(input0, concat, inputTensorInfo, 0, 0);
1453 BOOST_TEST_CHECKPOINT(
"connect input0 to concat");
1454 Connect(input1, concat, inputTensorInfo, 0, 1);
1455 BOOST_TEST_CHECKPOINT(
"connect input1 to concat");
1456 Connect(concat, output, outputTensorInfo, 0, 0);
1457 BOOST_TEST_CHECKPOINT(
"connect concat to output");
1459 CreateTensorHandles(graph, factory);
1460 BOOST_TEST_CHECKPOINT(
"created tensor handles");
1462 auto workloadConcat = MakeAndCheckWorkload<ConcatWorkload>(*concat, factory);
1463 BOOST_TEST_CHECKPOINT(
"created concat workload");
1465 return workloadConcat;
1468 template <
typename PreCompiledWorkload, armnn::DataType dataType>
1469 std::pair<armnn::IOptimizedNetworkPtr, std::unique_ptr<PreCompiledWorkload>> CreatePreCompiledWorkloadTest(
1472 bool biasEnabled =
false)
1481 BOOST_TEST(inputLayer);
1487 unsigned int weightsLength = weightsTensorInfo.GetNumElements();
1490 std::vector<WeightType> convWeightsData(weightsLength);
1491 for (
unsigned int i = 0; i < weightsLength; ++i)
1493 convWeightsData[i] =
static_cast<WeightType
>(i);
1506 const std::string convLayerName(
"conv layer");
1514 unsigned int biasLength = biasTensorInfo.GetNumElements();
1517 std::vector<BiasType> biasData(biasLength);
1518 std::fill(biasData.begin(), biasData.end(),
static_cast<BiasType
>(0));
1526 convLayerName.c_str());
1534 convLayerName.c_str());
1537 BOOST_TEST(convLayer);
1541 BOOST_TEST(outputLayer);
1545 if (dataType == armnn::DataType::QAsymmU8)
1547 inputTensorInfo.SetQuantizationOffset(0);
1548 inputTensorInfo.SetQuantizationScale(0.9f);
1552 if (dataType == armnn::DataType::QAsymmU8)
1554 outputTensorInfo.SetQuantizationOffset(0);
1555 outputTensorInfo.SetQuantizationScale(0.9f);
1566 std::vector<armnn::BackendId> backends = {factory.
GetBackendId()};
1576 Layer* preCompiledLayer =
nullptr;
1577 for (
auto& layer : optimisedGraph)
1581 preCompiledLayer = layer;
1587 CreateTensorHandles(optimisedGraph, factory);
1590 auto workload = MakeAndCheckWorkload<PreCompiledWorkload>(*preCompiledLayer, factory);
1593 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1594 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1599 return std::make_pair(std::move(optimizedNet), std::move(workload));
1602 template<
typename ConstantWorkload, armnn::DataType DataType>
1610 constant->
m_LayerOutput = std::make_unique<ScopedCpuTensorHandle>(outputTensorInfo);
1611 BOOST_TEST_CHECKPOINT(
"created constant layer");
1616 Connect(constant, output, outputTensorInfo, 0, 0);
1617 BOOST_TEST_CHECKPOINT(
"connect constant to output");
1619 CreateTensorHandles(graph, factory);
1620 BOOST_TEST_CHECKPOINT(
"created tensor handles");
1622 auto workloadConstant = MakeAndCheckWorkload<ConstantWorkload>(*constant, factory);
1623 BOOST_TEST_CHECKPOINT(
"created Constant workload");
1625 return workloadConstant;
1628 template <
typename PreluWorkload>
1652 Connect(input, layer, inputTensorInfo, 0, 0);
1653 Connect(alpha, layer, alphaTensorInfo, 0, 1);
1654 Connect(layer, output, outputTensorInfo, 0, 0);
1655 CreateTensorHandles(graph, factory);
1658 auto workload = MakeAndCheckWorkload<PreluWorkload>(*layer, factory);
1661 BOOST_TEST(queueDescriptor.m_Inputs.size() == 2);
1662 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1668 template <
typename SpaceToDepthWorkload, armnn::DataType DataType>
1684 Connect(input, layer, inputTensorInfo);
1685 Connect(layer, output, outputTensorInfo);
1687 CreateTensorHandles(graph, factory);
1690 auto workload = MakeAndCheckWorkload<SpaceToDepthWorkload>(*layer, factory);
1693 BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
1694 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1699 template <
typename StackWorkload, armnn::DataType DataType>
1705 unsigned int numInputs)
1716 std::vector<Layer*> inputs;
1717 for (
unsigned int i=0; i<numInputs; ++i)
1720 static_cast<int>(i),
1721 (
"input" + std::to_string(i)).c_str()
1729 for (
unsigned int i=0; i<numInputs; ++i)
1731 Connect(inputs[i], stackLayer, inputTensorInfo, 0, i);
1733 Connect(stackLayer, output, outputTensorInfo, 0, 0);
1735 CreateTensorHandles(graph, factory);
1737 auto stackWorkload = MakeAndCheckWorkload<StackWorkload>(*stackLayer, factory);
1739 BOOST_TEST(queueDescriptor.m_Inputs.size() == numInputs);
1740 BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
1742 return stackWorkload;
A layer that the constant data can be bound to.
std::unique_ptr< ScopedCpuTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
std::unique_ptr< ScopedCpuTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
bool m_ProjectionEnabled
Enable/disable the projection layer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
This layer represents a split operation.
static IRuntimePtr Create(const CreationOptions &options)
virtual const BackendId & GetBackendId() const =0
LstmBasicParameters m_BasicParameters
This layer represents a batch normalization operation.
A ViewsDescriptor for the SplitterLayer.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr) override
Adds an output layer to the network.
unsigned int GetWidthIndex() const
float m_K
Kappa value used for the across channel normalization equation.
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
std::unique_ptr< ScopedCpuTensorHandle > m_Weight
A unique pointer to store Weight values.
float m_ClippingThresProj
Clipping threshold value for the projection.
A ReshapeDescriptor for the ReshapeLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
std::unique_ptr< ScopedCpuTensorHandle > m_OutputGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
This layer represents a depthwise convolution 2d operation.
std::unique_ptr< ScopedCpuTensorHandle > m_CellLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
std::unique_ptr< ScopedCpuTensorHandle > m_Bias
A unique pointer to store Bias values.
uint32_t m_PoolWidth
Pooling width value.
bool m_PeepholeEnabled
Enable/disable peephole.
A Convolution2dDescriptor for the Convolution2dLayer.
float m_Alpha
Alpha value for the normalization equation.
uint32_t m_PadLeft
Padding left value in the width dimension.
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
This layer converts data type Float 16 to Float 32.
float m_HiddenStateScale
Hidden State quantization scale.
float m_OutputIntermediateScale
Output intermediate quantization scale.
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
This layer represents a SpaceToDepth operation.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr) override
Adds an input layer to the network.
std::unique_ptr< ScopedCpuTensorHandle > m_Gamma
A unique pointer to store Gamma values.
std::unique_ptr< ScopedCpuTensorHandle > m_OutputGateBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
This layer represents a reshape operation.
std::unique_ptr< ScopedCpuTensorHandle > m_Variance
A unique pointer to store Variance values.
std::unique_ptr< ScopedCpuTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
std::unique_ptr< ScopedCpuTensorHandle > m_CellBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
typename ResolveTypeImpl< DT >::Type ResolveType
This layer represents an activation operation with the specified activation function.
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_PadRight
Padding right value in the width dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Copyright (c) 2020 ARM Limited.
This layer represents a LSTM operation.
void IgnoreUnused(Ts &&...)
std::unique_ptr< ScopedCpuTensorHandle > m_InputToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
void SetBackendId(const BackendId &id)
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
std::unique_ptr< ScopedCpuTensorHandle > m_OutputLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
std::unique_ptr< ScopedCpuTensorHandle > m_CellBias
A unique pointer to represent 1D weights tensor with dimensions [num_units].
unsigned int GetHeightIndex() const
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
QLstmOptLayerNormParameters m_LayerNormParameters
NormalizationAlgorithmMethod m_NormMethodType
Normalization method algorithm to use (LocalBrightness, LocalContrast).
This layer represents a elementwiseUnary operation.
A ResizeDescriptor for the ResizeLayer.
std::unique_ptr< ScopedCpuTensorHandle > m_Beta
A unique pointer to store Beta values.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
IConnectableLayer * AddConvolution2dLayer(const Convolution2dDescriptor &convolution2dDescriptor, const ConstTensor &weights, const Optional< ConstTensor > &biases, const char *name=nullptr) override
Adds a 2D convolution layer to the network.
A StackDescriptor for the StackLayer.
TensorShape m_TargetShape
Target shape value.
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
uint32_t m_PoolHeight
Pooling height value.
uint32_t m_PadTop
Padding top value in the height dimension.
std::unique_ptr< ScopedCpuTensorHandle > m_CellToForgetWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
std::unique_ptr< ScopedCpuTensorHandle > m_LayerOutput
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
A layer user-provided data can be bound to (e.g. inputs, outputs).
bool m_LayerNormEnabled
Enable/disable layer normalization.
This layer represents a fully connected operation.
An LstmDescriptor for the LstmLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
uint32_t m_PadTop
Padding top value in the height dimension.
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.
This layer represents a QuantizedLstm operation.
std::unique_ptr< ScopedCpuTensorHandle > m_Mean
A unique pointer to store Mean values.
A L2NormalizationDescriptor for the L2NormalizationLayer.
Provides access to the appropriate indexes for Channels, Height and Width based on DataLayout...
An OriginsDescriptor for the ConcatLayer.
float m_ProjectionClip
Clipping threshold value for the projection.
A FullyConnectedDescriptor for the FullyConnectedLayer.
std::unique_ptr< ScopedCpuTensorHandle > m_Weight
A unique pointer to store Weight values.
bool m_BiasEnabled
Enable/disable bias.
This layer represents a stack operation.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
float m_InputIntermediateScale
Input intermediate quantization scale.
This layer represents a merge operation.
This layer represents a softmax operation.
uint32_t m_TargetWidth
Target width value.
bool m_PeepholeEnabled
Enable/disable peephole.
This layer represents a BatchToSpaceNd operation.
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
A QLstmDescriptor for the QLstmLayer.
std::unique_ptr< ScopedCpuTensorHandle > m_ForgetLayerNormWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units] (QSymmS16).
GPU Execution: OpenCL: ArmCompute.
static bool IsLayerSupported(const BackendId &backendId, const IConnectableLayer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
An ActivationDescriptor for the ActivationLayer.
uint32_t m_TargetHeight
Target height value.
uint32_t m_ActivationFunc
The activation function to use.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
This layer represents a normalization operation.
This layer represents a pooling 2d operation.
float m_ClippingThresCell
Clipping threshold value for the cell state.
This layer converts data type Float 32 to Float 16.
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
DataType GetBiasDataType(DataType inputDataType)
std::unique_ptr< ScopedCpuTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, inputSize] (QSymmS8)...
float m_ForgetIntermediateScale
Forget intermediate quantization scale.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [output_size, num_units].
QLstmBasicParameters m_BasicParameters
LstmOptPeepholeParameters m_PeepholeParameters
Private implementation of INetwork.
NormalizationAlgorithmChannel m_NormChannelType
Normalization channel algorithm to use (Across, Within).
This layer represents a QLstm operation.
float m_CellClip
Clipping threshold value for the cell state.
float m_A
Alpha upper bound value used by the activation functions. (BoundedReLu, Linear, TanH, Elu).
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
std::unique_ptr< ScopedCpuTensorHandle > m_InputToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
std::unique_ptr< ScopedCpuTensorHandle > m_ForgetGateBias
A unique pointer to represent 1D bias tensor with dimensions [num_units] (int32). ...
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
This layer represents a L2 normalization operation.
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToCellWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
CPU Execution: NEON: ArmCompute.
bool m_ProjectionEnabled
Enable/disable the projection layer.
OutputShapeRounding m_OutputShapeRounding
The rounding method for the output shape. (Floor, Ceiling).
std::unique_ptr< ScopedCpuTensorHandle > m_Bias
A unique pointer to store Bias values.
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
A MeanDescriptor for the MeanLayer.
std::unique_ptr< ScopedCpuTensorHandle > m_CellToOutputWeights
A unique pointer to represent 1D weights tensor with dimensions [num_units].
DataType GetDataType() const
std::unique_ptr< ScopedCpuTensorHandle > m_RecurrentToOutputWeights
A unique pointer to represent 2D weights tensor with dimensions [num_units, outputSize] (QSymmS8)...
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
This layer represents a convolution 2d operation.
void SetQuantizationOffset(int32_t offset)
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
OriginsDescriptor CreateDescriptorForConcatenation(TensorShapeIt first, TensorShapeIt last, unsigned int concatenationDimension)
Convenience template to create an OriginsDescriptor to use when creating a ConcatLayer for performing...
Graph & TopologicalSort()
Sorts layers in topological order and return this.
This layer represents a mean operation.
virtual int Connect(IInputSlot &destination)=0
Krichevsky 2012: Local Brightness Normalization.
std::unique_ptr< ScopedCpuTensorHandle > m_Weight
A unique pointer to store Weight values.
A Pooling2dDescriptor for the Pooling2dLayer.
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
A NormalizationDescriptor for the NormalizationLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
virtual void CreateTensorHandles(const TensorHandleFactoryRegistry ®istry, const IWorkloadFactory &factory, const bool IsMemoryManaged=true)
virtual std::unique_ptr< IWorkload > CreateWorkload(const IWorkloadFactory &factory) const =0
float m_CellIntermediateScale
Cell intermediate quantization scale.
std::unique_ptr< ScopedCpuTensorHandle > m_InputToForgetWeights
A unique pointer to represent 2D weights tensor with dimensions [input_size, num_units].
float m_B
Beta lower bound value used by the activation functions. (BoundedReLu, Linear, TanH).
A SoftmaxDescriptor for the SoftmaxLayer.
float m_Beta
Beta value for the normalization equation.
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
uint32_t m_NormSize
Depth radius value.
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square, Elu).
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
This layer represents a resize operation.
uint32_t m_PadRight
Padding right value in the width dimension.
int32_t m_HiddenStateZeroPoint
Hidden State zero point.