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(
"SerializeQuantize")
1839 const std::string layerName(
"quantize");
1854 CHECK(deserializedNetwork);
1860 TEST_CASE(
"SerializeRank")
1862 const std::string layerName(
"rank");
1878 CHECK(deserializedNetwork);
1884 TEST_CASE(
"SerializeReduceSum")
1886 const std::string layerName(
"Reduce_Sum");
1906 CHECK(deserializedNetwork);
1912 TEST_CASE(
"SerializeReshape")
1914 const std::string layerName(
"reshape");
1932 CHECK(deserializedNetwork);
1935 layerName, {inputInfo}, {outputInfo}, descriptor);
1939 TEST_CASE(
"SerializeResize")
1941 const std::string layerName(
"resize");
1947 desc.m_TargetHeight = 2;
1949 desc.m_AlignCorners =
true;
1950 desc.m_HalfPixelCenters =
true;
1964 CHECK(deserializedNetwork);
1973 ResizeBilinearLayerVerifier(
const std::string& layerName,
1974 const std::vector<armnn::TensorInfo>& inputInfos,
1975 const std::vector<armnn::TensorInfo>& outputInfos,
1978 layerName, inputInfos, outputInfos, descriptor) {}
1982 const std::vector<armnn::ConstTensor>& constants,
1993 VerifyNameAndConnections(layer, name);
1997 CHECK(layerDescriptor.
m_TargetWidth == m_Descriptor.m_TargetWidth);
1998 CHECK(layerDescriptor.
m_TargetHeight == m_Descriptor.m_TargetHeight);
1999 CHECK(layerDescriptor.
m_DataLayout == m_Descriptor.m_DataLayout);
2000 CHECK(layerDescriptor.
m_AlignCorners == m_Descriptor.m_AlignCorners);
2006 throw armnn::Exception(
"Unexpected layer type in test model. ResizeBiliniar " 2007 "should have translated to Resize");
2013 TEST_CASE(
"SerializeResizeBilinear")
2015 const std::string layerName(
"resizeBilinear");
2021 desc.m_TargetWidth = 4u;
2022 desc.m_TargetHeight = 2u;
2023 desc.m_AlignCorners =
true;
2024 desc.m_HalfPixelCenters =
true;
2038 CHECK(deserializedNetwork);
2040 ResizeBilinearLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2041 deserializedNetwork->ExecuteStrategy(verifier);
2044 TEST_CASE(
"EnsureResizeBilinearBackwardCompatibility")
2051 const std::vector<uint8_t> resizeBilinearModel =
2053 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
2054 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2055 0x50, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2056 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD4, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2057 0x04, 0x00, 0x00, 0x00, 0xC2, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
2058 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
2059 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2060 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2061 0x38, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
2062 0x00, 0x1A, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
2063 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x08, 0x00, 0x0C, 0x00,
2064 0x07, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
2065 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00,
2066 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
2067 0x20, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x42, 0x69, 0x6C, 0x69,
2068 0x6E, 0x65, 0x61, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2069 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
2070 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2071 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
2072 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2073 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
2074 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
2075 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00,
2076 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
2077 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2078 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00,
2079 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
2080 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2081 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2082 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
2086 DeserializeNetwork(std::string(resizeBilinearModel.begin(), resizeBilinearModel.end()));
2087 CHECK(deserializedNetwork);
2094 descriptor.m_TargetHeight = 2u;
2096 ResizeBilinearLayerVerifier verifier(
"resizeBilinear", { inputInfo }, { outputInfo }, descriptor);
2097 deserializedNetwork->ExecuteStrategy(verifier);
2100 TEST_CASE(
"SerializeShape")
2102 const std::string layerName(
"shape");
2118 CHECK(deserializedNetwork);
2125 TEST_CASE(
"SerializeSlice")
2127 const std::string layerName{
"slice"};
2147 CHECK(deserializedNetwork);
2153 TEST_CASE(
"SerializeSoftmax")
2155 const std::string layerName(
"softmax");
2159 descriptor.
m_Beta = 1.0f;
2173 CHECK(deserializedNetwork);
2179 TEST_CASE(
"SerializeSpaceToBatchNd")
2181 const std::string layerName(
"spaceToBatchNd");
2187 desc.m_BlockShape = {2, 2};
2188 desc.m_PadList = {{0, 0}, {2, 0}};
2202 CHECK(deserializedNetwork);
2205 layerName, {inputInfo}, {outputInfo}, desc);
2209 TEST_CASE(
"SerializeSpaceToDepth")
2211 const std::string layerName(
"spaceToDepth");
2232 CHECK(deserializedNetwork);
2235 layerName, {inputInfo}, {outputInfo}, desc);
2239 TEST_CASE(
"SerializeSplitter")
2241 const unsigned int numViews = 3;
2242 const unsigned int numDimensions = 4;
2243 const unsigned int inputShape[] = {1, 18, 4, 4};
2244 const unsigned int outputShape[] = {1, 6, 4, 4};
2247 unsigned int splitterDimSizes[4] = {
static_cast<unsigned int>(inputShape[0]),
2248 static_cast<unsigned int>(inputShape[1]),
2249 static_cast<unsigned int>(inputShape[2]),
2250 static_cast<unsigned int>(inputShape[3])};
2251 splitterDimSizes[1] /= numViews;
2254 for (
unsigned int g = 0; g < numViews; ++g)
2258 for (
unsigned int dimIdx=0; dimIdx < 4; dimIdx++)
2260 desc.
SetViewSize(g, dimIdx, splitterDimSizes[dimIdx]);
2264 const std::string layerName(
"splitter");
2286 CHECK(deserializedNetwork);
2289 layerName, {inputInfo}, {outputInfo, outputInfo, outputInfo}, desc);
2293 TEST_CASE(
"SerializeStack")
2295 const std::string layerName(
"stack");
2317 CHECK(deserializedNetwork);
2320 layerName, {inputTensorInfo, inputTensorInfo}, {outputTensorInfo}, descriptor);
2324 TEST_CASE(
"SerializeStandIn")
2326 const std::string layerName(
"standIn");
2351 CHECK(deserializedNetwork);
2354 layerName, { tensorInfo, tensorInfo }, { tensorInfo, tensorInfo }, descriptor);
2358 TEST_CASE(
"SerializeStridedSlice")
2360 const std::string layerName(
"stridedSlice");
2364 armnn::StridedSliceDescriptor desc({0, 0, 1, 0}, {1, 1, 1, 1}, {1, 1, 1, 1});
2366 desc.m_ShrinkAxisMask = (1 << 1) | (1 << 2);
2381 CHECK(deserializedNetwork);
2384 layerName, {inputInfo}, {outputInfo}, desc);
2388 TEST_CASE(
"SerializeSubtraction")
2390 const std::string layerName(
"subtraction");
2408 CHECK(deserializedNetwork);
2414 TEST_CASE(
"SerializeSwitch")
2419 SwitchLayerVerifier(
const std::string& layerName,
2420 const std::vector<armnn::TensorInfo>& inputInfos,
2421 const std::vector<armnn::TensorInfo>& outputInfos)
2426 const std::vector<armnn::ConstTensor>& constants,
2438 VerifyNameAndConnections(layer, name);
2449 const std::string layerName(
"switch");
2452 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2473 CHECK(deserializedNetwork);
2475 SwitchLayerVerifier verifier(layerName, {
info,
info}, {info, info});
2476 deserializedNetwork->ExecuteStrategy(verifier);
2479 TEST_CASE(
"SerializeTranspose")
2481 const std::string layerName(
"transpose");
2499 CHECK(deserializedNetwork);
2502 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2506 TEST_CASE(
"SerializeTransposeConvolution2d")
2508 const std::string layerName(
"transposeConvolution2d");
2515 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
2518 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
2534 network->AddTransposeConvolution2dLayer(descriptor,
2547 CHECK(deserializedNetwork);
2549 const std::vector<armnn::ConstTensor> constants {weights, biases};
2551 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
2555 TEST_CASE(
"SerializeDeserializeNonLinearNetwork")
2560 ConstantLayerVerifier(
const std::string& layerName,
2561 const std::vector<armnn::TensorInfo>& inputInfos,
2562 const std::vector<armnn::TensorInfo>& outputInfos,
2565 , m_LayerInput(layerInput) {}
2569 const std::vector<armnn::ConstTensor>& constants,
2581 VerifyNameAndConnections(layer, name);
2596 const std::string layerName(
"constant");
2599 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2617 CHECK(deserializedNetwork);
2619 ConstantLayerVerifier verifier(layerName, {}, {
info}, constTensor);
2620 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.
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).
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.