6 #include "../Serializer.hpp" 20 #include <doctest/doctest.h> 27 TEST_CASE(
"SerializeAddition")
29 const std::string layerName(
"addition");
48 CHECK(deserializedNetwork);
56 const std::string layerName(
"argminmax");
62 descriptor.m_Axis = 1;
76 CHECK(deserializedNetwork);
85 TEST_CASE(
"SerializeArgMinMaxSigned32")
90 TEST_CASE(
"SerializeArgMinMaxSigned64")
95 TEST_CASE(
"SerializeBatchNormalization")
97 const std::string layerName(
"batchNormalization");
107 descriptor.
m_Eps = 0.0010000000475f;
110 std::vector<float> meanData({5.0});
111 std::vector<float> varianceData({2.0});
112 std::vector<float> betaData({1.0});
113 std::vector<float> gammaData({0.0});
115 std::vector<armnn::ConstTensor> constants;
124 network->AddBatchNormalizationLayer(descriptor,
139 CHECK(deserializedNetwork);
142 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
146 TEST_CASE(
"SerializeBatchToSpaceNd")
148 const std::string layerName(
"spaceToBatchNd");
154 desc.m_BlockShape = {2, 2};
155 desc.m_Crops = {{0, 0}, {0, 0}};
169 CHECK(deserializedNetwork);
178 TEST_CASE(
"SerializeCast")
180 const std::string layerName(
"cast");
199 CHECK(deserializedNetwork);
205 TEST_CASE(
"SerializeChannelShuffle")
207 const std::string layerName(
"channelShuffle");
216 network->AddChannelShuffleLayer(descriptor, layerName.c_str());
226 CHECK(deserializedNetwork);
229 layerName, {inputInfo}, {outputInfo}, descriptor);
233 TEST_CASE(
"SerializeComparison")
235 const std::string layerName(
"comparison");
259 CHECK(deserializedNetwork);
262 { inputInfo, inputInfo },
268 TEST_CASE(
"SerializeConstant")
273 ConstantLayerVerifier(
const std::string& layerName,
274 const std::vector<armnn::TensorInfo>& inputInfos,
275 const std::vector<armnn::TensorInfo>& outputInfos,
276 const std::vector<armnn::ConstTensor>& constants)
278 , m_Constants(constants) {}
282 const std::vector<armnn::ConstTensor>& constants,
297 for (std::size_t i = 0; i < constants.size(); i++)
306 const std::vector<armnn::ConstTensor> m_Constants;
309 const std::string layerName(
"constant");
312 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
330 CHECK(deserializedNetwork);
332 ConstantLayerVerifier verifier(layerName, {}, {info}, {constTensor});
333 deserializedNetwork->ExecuteStrategy(verifier);
336 TEST_CASE(
"SerializeConvolution2d")
338 const std::string layerName(
"convolution2d");
345 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
348 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
366 network->AddConvolution2dLayer(descriptor,
379 CHECK(deserializedNetwork);
381 const std::vector<armnn::ConstTensor>& constants {weights, biases};
383 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
387 TEST_CASE(
"SerializeConvolution2dWithPerAxisParams")
389 using namespace armnn;
391 const std::string layerName(
"convolution2dWithPerAxis");
392 const TensorInfo inputInfo ({ 1, 3, 1, 2 }, DataType::QAsymmU8, 0.55f, 128);
393 const TensorInfo outputInfo({ 1, 3, 1, 3 }, DataType::QAsymmU8, 0.75f, 128);
395 const std::vector<float> quantScales{ 0.75f, 0.65f, 0.85f };
396 constexpr
unsigned int quantDimension = 0;
398 const TensorInfo kernelInfo({ 3, 1, 1, 2 }, DataType::QSymmS8, quantScales, quantDimension,
true);
400 const std::vector<float> biasQuantScales{ 0.25f, 0.50f, 0.75f };
401 const TensorInfo biasInfo({ 3 }, DataType::Signed32, biasQuantScales, quantDimension,
true);
403 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
405 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
421 network->AddConvolution2dLayer(descriptor,
434 CHECK(deserializedNetwork);
436 const std::vector<armnn::ConstTensor>& constants {weights, biases};
438 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
442 TEST_CASE(
"SerializeConvolution3d")
444 const std::string layerName(
"convolution3d");
451 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
454 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
491 CHECK(deserializedNetwork);
494 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
498 TEST_CASE(
"SerializeDepthToSpace")
500 const std::string layerName(
"depthToSpace");
521 CHECK(deserializedNetwork);
527 TEST_CASE(
"SerializeDepthwiseConvolution2d")
529 const std::string layerName(
"depwiseConvolution2d");
536 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
539 std::vector<int32_t> biasesData = GenerateRandomData<int32_t>(biasesInfo.GetNumElements());
557 network->AddDepthwiseConvolution2dLayer(descriptor,
570 CHECK(deserializedNetwork);
572 const std::vector<armnn::ConstTensor>& constants {weights, biases};
574 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
578 TEST_CASE(
"SerializeDepthwiseConvolution2dWithPerAxisParams")
580 using namespace armnn;
582 const std::string layerName(
"depwiseConvolution2dWithPerAxis");
583 const TensorInfo inputInfo ({ 1, 3, 3, 2 }, DataType::QAsymmU8, 0.55f, 128);
584 const TensorInfo outputInfo({ 1, 2, 2, 4 }, DataType::QAsymmU8, 0.75f, 128);
586 const std::vector<float> quantScales{ 0.75f, 0.80f, 0.90f, 0.95f };
587 const unsigned int quantDimension = 0;
588 TensorInfo kernelInfo({ 2, 2, 2, 2 }, DataType::QSymmS8, quantScales, quantDimension,
true);
590 const std::vector<float> biasQuantScales{ 0.25f, 0.35f, 0.45f, 0.55f };
591 constexpr
unsigned int biasQuantDimension = 0;
592 TensorInfo biasInfo({ 4 }, DataType::Signed32, biasQuantScales, biasQuantDimension,
true);
594 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
596 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
614 network->AddDepthwiseConvolution2dLayer(descriptor,
627 CHECK(deserializedNetwork);
629 const std::vector<armnn::ConstTensor>& constants {weights, biases};
631 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
635 TEST_CASE(
"SerializeDequantize")
637 const std::string layerName(
"dequantize");
653 CHECK(deserializedNetwork);
659 TEST_CASE(
"SerializeDeserializeDetectionPostProcess")
661 const std::string layerName(
"detectionPostProcess");
663 const std::vector<armnn::TensorInfo> inputInfos({
668 const std::vector<armnn::TensorInfo> outputInfos({
689 const std::vector<float> anchorsData({
690 0.5f, 0.5f, 1.0f, 1.0f,
691 0.5f, 0.5f, 1.0f, 1.0f,
692 0.5f, 0.5f, 1.0f, 1.0f,
693 0.5f, 10.5f, 1.0f, 1.0f,
694 0.5f, 10.5f, 1.0f, 1.0f,
695 0.5f, 100.5f, 1.0f, 1.0f
701 network->AddDetectionPostProcessLayer(descriptor, anchors, layerName.c_str());
703 for (
unsigned int i = 0; i < 2; i++)
710 for (
unsigned int i = 0; i < 4; i++)
718 CHECK(deserializedNetwork);
720 const std::vector<armnn::ConstTensor>& constants {anchors};
722 layerName, inputInfos, outputInfos, descriptor, constants);
723 deserializedNetwork->ExecuteStrategy(verifier);
726 TEST_CASE(
"SerializeDivision")
728 const std::string layerName(
"division");
746 CHECK(deserializedNetwork);
752 TEST_CASE(
"SerializeDeserializeComparisonEqual")
754 const std::string layerName(
"EqualLayer");
774 CHECK(deserializedNetwork);
776 LayerVerifierBase verifier(layerName, {inputTensorInfo1, inputTensorInfo2}, {outputTensorInfo});
794 network->AddElementwiseUnaryLayer(descriptor, layerName);
805 CHECK(deserializedNetwork);
808 verifier(layerName, { inputInfo }, { outputInfo }, descriptor);
813 TEST_CASE(
"SerializeElementwiseUnary")
816 std::initializer_list<op> allUnaryOperations = {op::Abs, op::Exp, op::Sqrt, op::Rsqrt, op::Neg,
817 op::LogicalNot, op::Log, op::Sin};
819 for (
auto unaryOperation : allUnaryOperations)
821 SerializeElementwiseUnaryTest(unaryOperation);
825 TEST_CASE(
"SerializeFill")
827 const std::string layerName(
"fill");
845 CHECK(deserializedNetwork);
852 TEST_CASE(
"SerializeFloor")
854 const std::string layerName(
"floor");
869 CHECK(deserializedNetwork);
879 FullyConnectedLayerVerifier(
const std::string& layerName,
880 const std::vector<armnn::TensorInfo>& inputInfos,
881 const std::vector<armnn::TensorInfo>& outputInfos,
887 const std::vector<armnn::ConstTensor>& constants,
899 VerifyNameAndConnections(layer, name);
903 CHECK(layerDescriptor.
m_BiasEnabled == m_Descriptor.m_BiasEnabled);
910 TEST_CASE(
"SerializeFullyConnected")
912 const std::string layerName(
"fullyConnected");
918 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
919 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
934 network->AddFullyConnectedLayer(descriptor,
943 fullyConnectedLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
946 fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
949 CHECK(deserializedNetwork);
951 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
952 deserializedNetwork->ExecuteStrategy(verifier);
955 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsInputs")
957 const std::string layerName(
"fullyConnected_weights_as_inputs");
977 network->AddFullyConnectedLayer(descriptor,
992 CHECK(deserializedNetwork);
994 const std::vector<armnn::ConstTensor> constants {};
996 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
1000 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsConstantLayers")
1002 const std::string layerName(
"fullyConnected_weights_as_inputs");
1009 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
1010 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
1023 armnn::IConnectableLayer*
const fullyConnectedLayer = network->AddFullyConnectedLayer(descriptor,layerName.c_str());
1037 CHECK(deserializedNetwork);
1039 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
1040 deserializedNetwork->ExecuteStrategy(verifier);
1043 TEST_CASE(
"SerializeGather")
1049 GatherLayerVerifier(
const std::string& layerName,
1050 const std::vector<armnn::TensorInfo>& inputInfos,
1051 const std::vector<armnn::TensorInfo>& outputInfos,
1057 const std::vector<armnn::ConstTensor>& constants,
1069 VerifyNameAndConnections(layer, name);
1071 CHECK(layerDescriptor.
m_Axis == m_Descriptor.m_Axis);
1077 const std::string layerName(
"gather");
1084 paramsInfo.SetQuantizationScale(1.0f);
1085 paramsInfo.SetQuantizationOffset(0);
1086 outputInfo.SetQuantizationScale(1.0f);
1087 outputInfo.SetQuantizationOffset(0);
1089 const std::vector<int32_t>& indicesData = {7, 6, 5};
1107 CHECK(deserializedNetwork);
1109 GatherLayerVerifier verifier(layerName, {paramsInfo, indicesInfo}, {outputInfo}, descriptor);
1110 deserializedNetwork->ExecuteStrategy(verifier);
1114 TEST_CASE(
"SerializeComparisonGreater")
1116 const std::string layerName(
"greater");
1139 CHECK(deserializedNetwork);
1141 LayerVerifierBase verifier(layerName, { inputInfo, inputInfo }, { outputInfo });
1146 TEST_CASE(
"SerializeInstanceNormalization")
1148 const std::string layerName(
"instanceNormalization");
1153 descriptor.m_Beta = 0.1f;
1154 descriptor.m_Eps = 0.0001f;
1160 network->AddInstanceNormalizationLayer(descriptor, layerName.c_str());
1170 CHECK(deserializedNetwork);
1173 layerName, {
info}, {
info}, descriptor);
1177 TEST_CASE(
"SerializeL2Normalization")
1179 const std::string l2NormLayerName(
"l2Normalization");
1184 desc.m_Eps = 0.0001f;
1198 CHECK(deserializedNetwork);
1201 l2NormLayerName, {
info}, {
info}, desc);
1205 TEST_CASE(
"EnsureL2NormalizationBackwardCompatibility")
1212 const std::vector<uint8_t> l2NormalizationModel =
1214 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1215 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1216 0x3C, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1217 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE8, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1218 0x04, 0x00, 0x00, 0x00, 0xD6, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
1219 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
1220 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1222 0x4C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
1223 0x00, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1224 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1225 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1226 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x20, 0x00,
1227 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x6C, 0x32, 0x4E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74,
1228 0x69, 0x6F, 0x6E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00,
1229 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1230 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
1231 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
1232 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1233 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1234 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1235 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1236 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1237 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1238 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1239 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1240 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1241 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1242 0x05, 0x00, 0x00, 0x00, 0x00
1246 DeserializeNetwork(std::string(l2NormalizationModel.begin(), l2NormalizationModel.end()));
1247 CHECK(deserializedNetwork);
1249 const std::string layerName(
"l2Normalization");
1255 desc.m_Eps = 1e-12f;
1258 layerName, {inputInfo}, {inputInfo}, desc);
1262 TEST_CASE(
"SerializeLogicalBinary")
1264 const std::string layerName(
"logicalBinaryAnd");
1276 armnn::IConnectableLayer*
const logicalBinaryLayer = network->AddLogicalBinaryLayer(descriptor, layerName.c_str());
1288 CHECK(deserializedNetwork);
1291 layerName, { inputInfo, inputInfo }, { outputInfo }, descriptor);
1295 TEST_CASE(
"SerializeLogSoftmax")
1297 const std::string layerName(
"log_softmax");
1301 descriptor.
m_Beta = 1.0f;
1302 descriptor.m_Axis = -1;
1316 CHECK(deserializedNetwork);
1322 TEST_CASE(
"SerializeMaximum")
1324 const std::string layerName(
"maximum");
1342 CHECK(deserializedNetwork);
1348 TEST_CASE(
"SerializeMean")
1350 const std::string layerName(
"mean");
1355 descriptor.
m_Axis = { 2 };
1356 descriptor.m_KeepDims =
true;
1370 CHECK(deserializedNetwork);
1376 TEST_CASE(
"SerializeMerge")
1378 const std::string layerName(
"merge");
1396 CHECK(deserializedNetwork);
1405 MergerLayerVerifier(
const std::string& layerName,
1406 const std::vector<armnn::TensorInfo>& inputInfos,
1407 const std::vector<armnn::TensorInfo>& outputInfos,
1413 const std::vector<armnn::ConstTensor>& constants,
1424 throw armnn::Exception(
"MergerLayer should have translated to ConcatLayer");
1429 VerifyNameAndConnections(layer, name);
1432 VerifyDescriptor(layerDescriptor);
1443 TEST_CASE(
"EnsureMergerLayerBackwardCompatibility")
1450 const std::vector<uint8_t> mergerModel =
1452 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1453 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1454 0x38, 0x02, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1456 0xF4, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1457 0x00, 0x00, 0x9A, 0xFE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x7E, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1458 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1460 0xF8, 0xFE, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1461 0x00, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1462 0x68, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1463 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1464 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1465 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1466 0x00, 0x00, 0x00, 0x00, 0x3E, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1468 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1469 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6D, 0x65, 0x72, 0x67, 0x65, 0x72, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1470 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1471 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1472 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
1473 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1474 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1475 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1476 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1477 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1478 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1479 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1480 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1482 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1483 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1484 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1485 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1486 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1487 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1488 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1489 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1490 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1491 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1492 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1493 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1494 0x02, 0x00, 0x00, 0x00
1498 CHECK(deserializedNetwork);
1503 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1508 MergerLayerVerifier verifier(
"merger", { inputInfo, inputInfo }, { outputInfo }, descriptor);
1509 deserializedNetwork->ExecuteStrategy(verifier);
1512 TEST_CASE(
"SerializeConcat")
1514 const std::string layerName(
"concat");
1518 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1539 CHECK(deserializedNetwork);
1543 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1544 deserializedNetwork->ExecuteStrategy(verifier);
1547 TEST_CASE(
"SerializeMinimum")
1549 const std::string layerName(
"minimum");
1567 CHECK(deserializedNetwork);
1573 TEST_CASE(
"SerializeMultiplication")
1575 const std::string layerName(
"multiplication");
1593 CHECK(deserializedNetwork);
1599 TEST_CASE(
"SerializePrelu")
1601 const std::string layerName(
"prelu");
1622 CHECK(deserializedNetwork);
1624 LayerVerifierBase verifier(layerName, {inputTensorInfo, alphaTensorInfo}, {outputTensorInfo});
1628 TEST_CASE(
"SerializeNormalization")
1630 const std::string layerName(
"normalization");
1635 desc.m_NormSize = 3;
1652 CHECK(deserializedNetwork);
1658 TEST_CASE(
"SerializePad")
1660 const std::string layerName(
"pad");
1678 CHECK(deserializedNetwork);
1687 TEST_CASE(
"SerializePadReflect")
1689 const std::string layerName(
"padReflect");
1708 CHECK(deserializedNetwork);
1717 TEST_CASE(
"EnsurePadBackwardCompatibility")
1725 const std::vector<uint8_t> padModel =
1727 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1728 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1729 0x54, 0x01, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1730 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD0, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1731 0x04, 0x00, 0x00, 0x00, 0x96, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1732 0x00, 0x00, 0x72, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1733 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
1734 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
1735 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x16, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00,
1736 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
1737 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
1738 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1739 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
1740 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1741 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00,
1742 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x61, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
1743 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1744 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1745 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
1746 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
1747 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00,
1748 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00,
1749 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1750 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00,
1751 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
1752 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
1753 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
1754 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1755 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
1756 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
1760 CHECK(deserializedNetwork);
1771 TEST_CASE(
"SerializePermute")
1773 const std::string layerName(
"permute");
1791 CHECK(deserializedNetwork);
1794 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
1798 TEST_CASE(
"SerializePooling2d")
1800 const std::string layerName(
"pooling2d");
1807 desc.m_PadBottom = 0;
1809 desc.m_PadRight = 0;
1813 desc.m_PoolHeight = 2;
1814 desc.m_PoolWidth = 2;
1830 CHECK(deserializedNetwork);
1833 layerName, {inputInfo}, {outputInfo}, desc);
1837 TEST_CASE(
"SerializePooling3d")
1839 const std::string layerName(
"pooling3d");
1845 desc.m_PadFront = 0;
1848 desc.m_PadBottom = 0;
1850 desc.m_PadRight = 0;
1854 desc.m_PoolHeight = 2;
1855 desc.m_PoolWidth = 2;
1856 desc.m_PoolDepth = 2;
1873 CHECK(deserializedNetwork);
1876 layerName, {inputInfo}, {outputInfo}, desc);
1880 TEST_CASE(
"SerializeQuantize")
1882 const std::string layerName(
"quantize");
1897 CHECK(deserializedNetwork);
1903 TEST_CASE(
"SerializeRank")
1905 const std::string layerName(
"rank");
1921 CHECK(deserializedNetwork);
1927 TEST_CASE(
"SerializeReduceSum")
1929 const std::string layerName(
"Reduce_Sum");
1949 CHECK(deserializedNetwork);
1955 TEST_CASE(
"SerializeReshape")
1957 const std::string layerName(
"reshape");
1975 CHECK(deserializedNetwork);
1978 layerName, {inputInfo}, {outputInfo}, descriptor);
1982 TEST_CASE(
"SerializeResize")
1984 const std::string layerName(
"resize");
1990 desc.m_TargetHeight = 2;
1992 desc.m_AlignCorners =
true;
1993 desc.m_HalfPixelCenters =
true;
2007 CHECK(deserializedNetwork);
2016 ResizeBilinearLayerVerifier(
const std::string& layerName,
2017 const std::vector<armnn::TensorInfo>& inputInfos,
2018 const std::vector<armnn::TensorInfo>& outputInfos,
2021 layerName, inputInfos, outputInfos, descriptor) {}
2025 const std::vector<armnn::ConstTensor>& constants,
2036 VerifyNameAndConnections(layer, name);
2040 CHECK(layerDescriptor.
m_TargetWidth == m_Descriptor.m_TargetWidth);
2041 CHECK(layerDescriptor.
m_TargetHeight == m_Descriptor.m_TargetHeight);
2042 CHECK(layerDescriptor.
m_DataLayout == m_Descriptor.m_DataLayout);
2043 CHECK(layerDescriptor.
m_AlignCorners == m_Descriptor.m_AlignCorners);
2049 throw armnn::Exception(
"Unexpected layer type in test model. ResizeBiliniar " 2050 "should have translated to Resize");
2056 TEST_CASE(
"SerializeResizeBilinear")
2058 const std::string layerName(
"resizeBilinear");
2064 desc.m_TargetWidth = 4u;
2065 desc.m_TargetHeight = 2u;
2066 desc.m_AlignCorners =
true;
2067 desc.m_HalfPixelCenters =
true;
2081 CHECK(deserializedNetwork);
2083 ResizeBilinearLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2084 deserializedNetwork->ExecuteStrategy(verifier);
2087 TEST_CASE(
"EnsureResizeBilinearBackwardCompatibility")
2094 const std::vector<uint8_t> resizeBilinearModel =
2096 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
2097 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2098 0x50, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2099 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD4, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2100 0x04, 0x00, 0x00, 0x00, 0xC2, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
2101 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
2102 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2104 0x38, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
2105 0x00, 0x1A, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
2106 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x08, 0x00, 0x0C, 0x00,
2107 0x07, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
2108 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00,
2109 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
2110 0x20, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x42, 0x69, 0x6C, 0x69,
2111 0x6E, 0x65, 0x61, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2112 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
2113 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2114 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
2115 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2116 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
2117 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
2118 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00,
2119 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
2120 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00,
2122 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
2123 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2124 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2125 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
2129 DeserializeNetwork(std::string(resizeBilinearModel.begin(), resizeBilinearModel.end()));
2130 CHECK(deserializedNetwork);
2137 descriptor.m_TargetHeight = 2u;
2139 ResizeBilinearLayerVerifier verifier(
"resizeBilinear", { inputInfo }, { outputInfo }, descriptor);
2140 deserializedNetwork->ExecuteStrategy(verifier);
2143 TEST_CASE(
"SerializeShape")
2145 const std::string layerName(
"shape");
2161 CHECK(deserializedNetwork);
2168 TEST_CASE(
"SerializeSlice")
2170 const std::string layerName{
"slice"};
2190 CHECK(deserializedNetwork);
2196 TEST_CASE(
"SerializeSoftmax")
2198 const std::string layerName(
"softmax");
2202 descriptor.
m_Beta = 1.0f;
2216 CHECK(deserializedNetwork);
2222 TEST_CASE(
"SerializeSpaceToBatchNd")
2224 const std::string layerName(
"spaceToBatchNd");
2230 desc.m_BlockShape = {2, 2};
2231 desc.m_PadList = {{0, 0}, {2, 0}};
2245 CHECK(deserializedNetwork);
2248 layerName, {inputInfo}, {outputInfo}, desc);
2252 TEST_CASE(
"SerializeSpaceToDepth")
2254 const std::string layerName(
"spaceToDepth");
2275 CHECK(deserializedNetwork);
2278 layerName, {inputInfo}, {outputInfo}, desc);
2282 TEST_CASE(
"SerializeSplitter")
2284 const unsigned int numViews = 3;
2285 const unsigned int numDimensions = 4;
2286 const unsigned int inputShape[] = {1, 18, 4, 4};
2287 const unsigned int outputShape[] = {1, 6, 4, 4};
2290 unsigned int splitterDimSizes[4] = {
static_cast<unsigned int>(inputShape[0]),
2291 static_cast<unsigned int>(inputShape[1]),
2292 static_cast<unsigned int>(inputShape[2]),
2293 static_cast<unsigned int>(inputShape[3])};
2294 splitterDimSizes[1] /= numViews;
2297 for (
unsigned int g = 0; g < numViews; ++g)
2301 for (
unsigned int dimIdx=0; dimIdx < 4; dimIdx++)
2303 desc.
SetViewSize(g, dimIdx, splitterDimSizes[dimIdx]);
2307 const std::string layerName(
"splitter");
2329 CHECK(deserializedNetwork);
2332 layerName, {inputInfo}, {outputInfo, outputInfo, outputInfo}, desc);
2336 TEST_CASE(
"SerializeStack")
2338 const std::string layerName(
"stack");
2360 CHECK(deserializedNetwork);
2363 layerName, {inputTensorInfo, inputTensorInfo}, {outputTensorInfo}, descriptor);
2367 TEST_CASE(
"SerializeStandIn")
2369 const std::string layerName(
"standIn");
2394 CHECK(deserializedNetwork);
2397 layerName, { tensorInfo, tensorInfo }, { tensorInfo, tensorInfo }, descriptor);
2401 TEST_CASE(
"SerializeStridedSlice")
2403 const std::string layerName(
"stridedSlice");
2407 armnn::StridedSliceDescriptor desc({0, 0, 1, 0}, {1, 1, 1, 1}, {1, 1, 1, 1});
2409 desc.m_ShrinkAxisMask = (1 << 1) | (1 << 2);
2424 CHECK(deserializedNetwork);
2427 layerName, {inputInfo}, {outputInfo}, desc);
2431 TEST_CASE(
"SerializeSubtraction")
2433 const std::string layerName(
"subtraction");
2451 CHECK(deserializedNetwork);
2457 TEST_CASE(
"SerializeSwitch")
2462 SwitchLayerVerifier(
const std::string& layerName,
2463 const std::vector<armnn::TensorInfo>& inputInfos,
2464 const std::vector<armnn::TensorInfo>& outputInfos)
2469 const std::vector<armnn::ConstTensor>& constants,
2481 VerifyNameAndConnections(layer, name);
2492 const std::string layerName(
"switch");
2495 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2516 CHECK(deserializedNetwork);
2518 SwitchLayerVerifier verifier(layerName, {
info,
info}, {info, info});
2519 deserializedNetwork->ExecuteStrategy(verifier);
2522 TEST_CASE(
"SerializeTranspose")
2524 const std::string layerName(
"transpose");
2542 CHECK(deserializedNetwork);
2545 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2549 TEST_CASE(
"SerializeTransposeConvolution2d")
2551 const std::string layerName(
"transposeConvolution2d");
2558 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
2561 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
2577 network->AddTransposeConvolution2dLayer(descriptor,
2590 CHECK(deserializedNetwork);
2592 const std::vector<armnn::ConstTensor> constants {weights, biases};
2594 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
2598 TEST_CASE(
"SerializeDeserializeNonLinearNetwork")
2603 ConstantLayerVerifier(
const std::string& layerName,
2604 const std::vector<armnn::TensorInfo>& inputInfos,
2605 const std::vector<armnn::TensorInfo>& outputInfos,
2608 , m_LayerInput(layerInput) {}
2612 const std::vector<armnn::ConstTensor>& constants,
2624 VerifyNameAndConnections(layer, name);
2639 const std::string layerName(
"constant");
2642 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2660 CHECK(deserializedNetwork);
2662 ConstantLayerVerifier verifier(layerName, {}, {
info}, constTensor);
2663 deserializedNetwork->ExecuteStrategy(verifier);
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A ViewsDescriptor for the SplitterLayer.
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
float m_ScaleW
Center size encoding scale weight.
bool m_BiasEnabled
Enable/disable bias.
A TransposeConvolution2dDescriptor for the TransposeConvolution2dLayer.
const TensorShape & GetShape() const
uint32_t m_PadBottom
Padding bottom value in the height dimension.
A ReshapeDescriptor for the ReshapeLayer.
armnn::INetworkPtr DeserializeNetwork(const std::string &serializerString)
uint32_t m_PadBack
Padding back value in the depth dimension.
#define ARMNN_NO_DEPRECATE_WARN_BEGIN
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A ComparisonDescriptor for the ComparisonLayer.
float m_ScaleX
Center size encoding scale x.
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
A Convolution2dDescriptor for the Convolution2dLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
bool m_BiasEnabled
Enable/disable bias.
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
float m_Gamma
Gamma, the scale scalar value applied for the normalized tensor. Defaults to 1.0. ...
float m_Beta
Exponentiation value.
The padding fields don't count and are ignored.
float m_Eps
Value to add to the variance. Used to avoid dividing by zero.
ArgMinMaxFunction m_Function
Specify if the function is to find Min or Max.
uint32_t m_DetectionsPerClass
Detections per classes, used in Regular NMS.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool m_BiasEnabled
Enable/disable bias.
A LogicalBinaryDescriptor for the LogicalBinaryLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0) override
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
Copyright (c) 2021 ARM Limited and Contributors.
DataLayout m_DataLayout
The data layout to be used (NCDHW, NDHWC).
void IgnoreUnused(Ts &&...)
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_DilationY
Dilation along y axis.
int32_t m_EndMask
End mask value.
A SpaceToDepthDescriptor for the SpaceToDepthLayer.
uint32_t m_DilationX
Dilation along x axis.
uint32_t m_DilationY
Dilation factor value for height dimension.
A BatchToSpaceNdDescriptor for the BatchToSpaceNdLayer.
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A ResizeBilinearDescriptor for the ResizeBilinearLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_MaxClassesPerDetection
Maximum numbers of classes per detection, used in Fast NMS.
Base class for all descriptors.
std::vector< unsigned int > m_Axis
Values for the dimensions to reduce.
A StackDescriptor for the StackLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
constexpr char const * GetUnaryOperationAsCString(UnaryOperation operation)
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_MaxDetections
Maximum numbers of detections.
A PadDescriptor for the PadLayer.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
float m_NmsIouThreshold
Intersection over union threshold.
#define ARMNN_NO_DEPRECATE_WARN_END
uint32_t m_DilationX
Dilation factor value for width dimension.
uint32_t m_PadTop
Padding top value in the height dimension.
Status SetViewSize(uint32_t view, uint32_t coord, uint32_t value)
Set the size of the views.
void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0) override
A L2NormalizationDescriptor for the L2NormalizationLayer.
void VerifyNameAndConnections(const armnn::IConnectableLayer *layer, const char *name)
An ArgMinMaxDescriptor for ArgMinMaxLayer.
An OriginsDescriptor for the ConcatLayer.
A ReduceDescriptor for the REDUCE operators.
A FullyConnectedDescriptor for the FullyConnectedLayer.
bool m_BiasEnabled
Enable/disable bias.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
uint32_t m_TargetWidth
Target width value.
A GatherDescriptor for the GatherLayer.
uint32_t m_NumClasses
Number of classes.
bool m_HalfPixelCenters
Half Pixel Centers.
uint32_t m_PadTop
Padding top value in the height dimension.
A StandInDescriptor for the StandIn layer.
LayerVerifierBase(const std::string &layerName, const std::vector< armnn::TensorInfo > &inputInfos, const std::vector< armnn::TensorInfo > &outputInfos)
bool m_UseRegularNms
Use Regular NMS.
uint32_t m_PadFront
Padding front value in the depth dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_TargetHeight
Target height value.
A SliceDescriptor for the SliceLayer.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
A Convolution3dDescriptor for the Convolution3dLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
virtual LayerType GetType() const =0
Returns the armnn::LayerType of this layer.
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
PaddingMode m_PaddingMode
Specifies the Padding mode (Constant, Reflect or Symmetric)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
A Pooling3dDescriptor for the Pooling3dLayer.
std::vector< uint32_t > m_vAxis
The indices of the dimensions to reduce.
float m_ScaleH
Center size encoding scale height.
A SpaceToBatchNdDescriptor for the SpaceToBatchNdLayer.
DataLayout m_DataLayout
The data layout to be used (NDHWC, NCDHW).
uint32_t m_DilationX
Dilation along x axis.
uint32_t m_PadLeft
Padding left value in the width dimension.
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
bool m_AlignCorners
Aligned corners.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
int32_t m_Axis
The axis in params to gather indices from.
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
TEST_SUITE("SerializerTests")
Base class for all ArmNN exceptions so that users can filter to just those.
uint32_t m_PadTop
Padding top value in the height dimension.
void CompareConstTensor(const armnn::ConstTensor &tensor1, const armnn::ConstTensor &tensor2)
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
A MeanDescriptor for the MeanLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
A TransposeDescriptor for the TransposeLayer.
A StridedSliceDescriptor for the StridedSliceLayer.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
float m_ScaleY
Center size encoding scale y.
OriginsDescriptor CreateDescriptorForConcatenation(TensorShapeIt first, TensorShapeIt last, unsigned int concatenationDimension)
Convenience template to create an OriginsDescriptor to use when creating a ConcatLayer for performing...
float m_NmsScoreThreshold
NMS score threshold.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
A Pooling2dDescriptor for the Pooling2dLayer.
std::string SerializeNetwork(const armnn::INetwork &network)
A NormalizationDescriptor for the NormalizationLayer.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
An InstanceNormalizationDescriptor for InstanceNormalizationLayer.
A ChannelShuffleDescriptor for the ChannelShuffle operator.
static INetworkPtr Create(NetworkOptions networkOptions={})
uint32_t m_DilationZ
Dilation along z axis.
A SoftmaxDescriptor for the SoftmaxLayer.
uint32_t m_StrideZ
Stride value when proceeding through input for the depth dimension.
Status SetViewOriginCoord(uint32_t view, uint32_t coord, uint32_t value)
Set the view origin coordinates.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
uint32_t m_DilationY
Dilation along y axis.
A FillDescriptor for the FillLayer.
A BatchNormalizationDescriptor for the BatchNormalizationLayer.
uint32_t m_PadLeft
Padding left value in the width dimension.
void ExecuteStrategy(const armnn::IConnectableLayer *layer, const armnn::BaseDescriptor &descriptor, const std::vector< armnn::ConstTensor > &constants, const char *name, const armnn::LayerBindingId id=0) override
A PermuteDescriptor for the PermuteLayer.
uint32_t m_PadRight
Padding right value in the width dimension.
bool m_ConstantWeights
Enable/disable constant weights and biases.