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(
"SerializeComparison")
207 const std::string layerName(
"comparison");
231 CHECK(deserializedNetwork);
234 { inputInfo, inputInfo },
240 TEST_CASE(
"SerializeConstant")
245 ConstantLayerVerifier(
const std::string& layerName,
246 const std::vector<armnn::TensorInfo>& inputInfos,
247 const std::vector<armnn::TensorInfo>& outputInfos,
248 const std::vector<armnn::ConstTensor>& constants)
250 , m_Constants(constants) {}
254 const std::vector<armnn::ConstTensor>& constants,
269 for (std::size_t i = 0; i < constants.size(); i++)
278 const std::vector<armnn::ConstTensor> m_Constants;
281 const std::string layerName(
"constant");
284 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
302 CHECK(deserializedNetwork);
304 ConstantLayerVerifier verifier(layerName, {}, {info}, {constTensor});
305 deserializedNetwork->ExecuteStrategy(verifier);
308 TEST_CASE(
"SerializeConvolution2d")
310 const std::string layerName(
"convolution2d");
317 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
320 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
338 network->AddConvolution2dLayer(descriptor,
351 CHECK(deserializedNetwork);
353 const std::vector<armnn::ConstTensor>& constants {weights, biases};
355 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
359 TEST_CASE(
"SerializeConvolution2dWithPerAxisParams")
361 using namespace armnn;
363 const std::string layerName(
"convolution2dWithPerAxis");
364 const TensorInfo inputInfo ({ 1, 3, 1, 2 }, DataType::QAsymmU8, 0.55f, 128);
365 const TensorInfo outputInfo({ 1, 3, 1, 3 }, DataType::QAsymmU8, 0.75f, 128);
367 const std::vector<float> quantScales{ 0.75f, 0.65f, 0.85f };
368 constexpr
unsigned int quantDimension = 0;
370 const TensorInfo kernelInfo({ 3, 1, 1, 2 }, DataType::QSymmS8, quantScales, quantDimension);
372 const std::vector<float> biasQuantScales{ 0.25f, 0.50f, 0.75f };
373 const TensorInfo biasInfo({ 3 }, DataType::Signed32, biasQuantScales, quantDimension);
375 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
377 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
393 network->AddConvolution2dLayer(descriptor,
406 CHECK(deserializedNetwork);
408 const std::vector<armnn::ConstTensor>& constants {weights, biases};
410 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
414 TEST_CASE(
"SerializeDepthToSpace")
416 const std::string layerName(
"depthToSpace");
437 CHECK(deserializedNetwork);
443 TEST_CASE(
"SerializeDepthwiseConvolution2d")
445 const std::string layerName(
"depwiseConvolution2d");
452 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
455 std::vector<int32_t> biasesData = GenerateRandomData<int32_t>(biasesInfo.GetNumElements());
473 network->AddDepthwiseConvolution2dLayer(descriptor,
486 CHECK(deserializedNetwork);
488 const std::vector<armnn::ConstTensor>& constants {weights, biases};
490 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
494 TEST_CASE(
"SerializeDepthwiseConvolution2dWithPerAxisParams")
496 using namespace armnn;
498 const std::string layerName(
"depwiseConvolution2dWithPerAxis");
499 const TensorInfo inputInfo ({ 1, 3, 3, 2 }, DataType::QAsymmU8, 0.55f, 128);
500 const TensorInfo outputInfo({ 1, 2, 2, 4 }, DataType::QAsymmU8, 0.75f, 128);
502 const std::vector<float> quantScales{ 0.75f, 0.80f, 0.90f, 0.95f };
503 const unsigned int quantDimension = 0;
504 TensorInfo kernelInfo({ 2, 2, 2, 2 }, DataType::QSymmS8, quantScales, quantDimension);
506 const std::vector<float> biasQuantScales{ 0.25f, 0.35f, 0.45f, 0.55f };
507 constexpr
unsigned int biasQuantDimension = 0;
508 TensorInfo biasInfo({ 4 }, DataType::Signed32, biasQuantScales, biasQuantDimension);
510 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
512 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
530 network->AddDepthwiseConvolution2dLayer(descriptor,
543 CHECK(deserializedNetwork);
545 const std::vector<armnn::ConstTensor>& constants {weights, biases};
547 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
551 TEST_CASE(
"SerializeDequantize")
553 const std::string layerName(
"dequantize");
569 CHECK(deserializedNetwork);
575 TEST_CASE(
"SerializeDeserializeDetectionPostProcess")
577 const std::string layerName(
"detectionPostProcess");
579 const std::vector<armnn::TensorInfo> inputInfos({
584 const std::vector<armnn::TensorInfo> outputInfos({
605 const std::vector<float> anchorsData({
606 0.5f, 0.5f, 1.0f, 1.0f,
607 0.5f, 0.5f, 1.0f, 1.0f,
608 0.5f, 0.5f, 1.0f, 1.0f,
609 0.5f, 10.5f, 1.0f, 1.0f,
610 0.5f, 10.5f, 1.0f, 1.0f,
611 0.5f, 100.5f, 1.0f, 1.0f
617 network->AddDetectionPostProcessLayer(descriptor, anchors, layerName.c_str());
619 for (
unsigned int i = 0; i < 2; i++)
626 for (
unsigned int i = 0; i < 4; i++)
634 CHECK(deserializedNetwork);
636 const std::vector<armnn::ConstTensor>& constants {anchors};
638 layerName, inputInfos, outputInfos, descriptor, constants);
639 deserializedNetwork->ExecuteStrategy(verifier);
642 TEST_CASE(
"SerializeDivision")
644 const std::string layerName(
"division");
662 CHECK(deserializedNetwork);
668 TEST_CASE(
"SerializeDeserializeEqual")
670 const std::string layerName(
"EqualLayer");
687 equalLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
688 equalLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
691 CHECK(deserializedNetwork);
693 LayerVerifierBase verifier(layerName, {inputTensorInfo1, inputTensorInfo2}, {outputTensorInfo});
711 network->AddElementwiseUnaryLayer(descriptor, layerName);
722 CHECK(deserializedNetwork);
725 verifier(layerName, { inputInfo }, { outputInfo }, descriptor);
730 TEST_CASE(
"SerializeElementwiseUnary")
733 std::initializer_list<op> allUnaryOperations = {op::Abs, op::Exp, op::Sqrt, op::Rsqrt, op::Neg,
734 op::LogicalNot, op::Log, op::Sin};
736 for (
auto unaryOperation : allUnaryOperations)
738 SerializeElementwiseUnaryTest(unaryOperation);
742 TEST_CASE(
"SerializeFill")
744 const std::string layerName(
"fill");
762 CHECK(deserializedNetwork);
769 TEST_CASE(
"SerializeFloor")
771 const std::string layerName(
"floor");
786 CHECK(deserializedNetwork);
796 FullyConnectedLayerVerifier(
const std::string& layerName,
797 const std::vector<armnn::TensorInfo>& inputInfos,
798 const std::vector<armnn::TensorInfo>& outputInfos,
804 const std::vector<armnn::ConstTensor>& constants,
816 VerifyNameAndConnections(layer, name);
820 CHECK(layerDescriptor.
m_BiasEnabled == m_Descriptor.m_BiasEnabled);
827 TEST_CASE(
"SerializeFullyConnected")
829 const std::string layerName(
"fullyConnected");
835 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
836 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
851 network->AddFullyConnectedLayer(descriptor,
860 fullyConnectedLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
863 fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
866 CHECK(deserializedNetwork);
868 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
869 deserializedNetwork->ExecuteStrategy(verifier);
872 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsInputs")
874 const std::string layerName(
"fullyConnected_weights_as_inputs");
894 network->AddFullyConnectedLayer(descriptor,
909 CHECK(deserializedNetwork);
911 const std::vector<armnn::ConstTensor> constants {};
913 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
917 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsConstantLayers")
919 const std::string layerName(
"fullyConnected_weights_as_inputs");
926 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
927 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
940 armnn::IConnectableLayer*
const fullyConnectedLayer = network->AddFullyConnectedLayer(descriptor,layerName.c_str());
954 CHECK(deserializedNetwork);
956 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
957 deserializedNetwork->ExecuteStrategy(verifier);
960 TEST_CASE(
"SerializeGather")
966 GatherLayerVerifier(
const std::string& layerName,
967 const std::vector<armnn::TensorInfo>& inputInfos,
968 const std::vector<armnn::TensorInfo>& outputInfos,
974 const std::vector<armnn::ConstTensor>& constants,
986 VerifyNameAndConnections(layer, name);
988 CHECK(layerDescriptor.
m_Axis == m_Descriptor.m_Axis);
994 const std::string layerName(
"gather");
1001 paramsInfo.SetQuantizationScale(1.0f);
1002 paramsInfo.SetQuantizationOffset(0);
1003 outputInfo.SetQuantizationScale(1.0f);
1004 outputInfo.SetQuantizationOffset(0);
1006 const std::vector<int32_t>& indicesData = {7, 6, 5};
1024 CHECK(deserializedNetwork);
1026 GatherLayerVerifier verifier(layerName, {paramsInfo, indicesInfo}, {outputInfo}, descriptor);
1027 deserializedNetwork->ExecuteStrategy(verifier);
1034 TEST_CASE(
"SerializeGreaterDeprecated")
1036 const std::string layerName(
"greater");
1053 equalLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1057 equalLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1060 CHECK(deserializedNetwork);
1062 LayerVerifierBase verifier(layerName, { inputInfo, inputInfo }, { outputInfo });
1067 TEST_CASE(
"SerializeInstanceNormalization")
1069 const std::string layerName(
"instanceNormalization");
1074 descriptor.m_Beta = 0.1f;
1075 descriptor.m_Eps = 0.0001f;
1081 network->AddInstanceNormalizationLayer(descriptor, layerName.c_str());
1091 CHECK(deserializedNetwork);
1094 layerName, {
info}, {
info}, descriptor);
1098 TEST_CASE(
"SerializeL2Normalization")
1100 const std::string l2NormLayerName(
"l2Normalization");
1105 desc.m_Eps = 0.0001f;
1119 CHECK(deserializedNetwork);
1122 l2NormLayerName, {
info}, {
info}, desc);
1126 TEST_CASE(
"EnsureL2NormalizationBackwardCompatibility")
1133 const std::vector<uint8_t> l2NormalizationModel =
1135 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1136 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1137 0x3C, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1138 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE8, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1139 0x04, 0x00, 0x00, 0x00, 0xD6, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
1140 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
1141 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1143 0x4C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
1144 0x00, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1145 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1146 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1147 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x20, 0x00,
1148 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x6C, 0x32, 0x4E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74,
1149 0x69, 0x6F, 0x6E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00,
1150 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1151 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
1152 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
1153 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1154 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1155 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1156 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1157 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1158 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1159 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1160 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1161 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1162 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1163 0x05, 0x00, 0x00, 0x00, 0x00
1167 DeserializeNetwork(std::string(l2NormalizationModel.begin(), l2NormalizationModel.end()));
1168 CHECK(deserializedNetwork);
1170 const std::string layerName(
"l2Normalization");
1176 desc.m_Eps = 1e-12f;
1179 layerName, {inputInfo}, {inputInfo}, desc);
1183 TEST_CASE(
"SerializeLogicalBinary")
1185 const std::string layerName(
"logicalBinaryAnd");
1197 armnn::IConnectableLayer*
const logicalBinaryLayer = network->AddLogicalBinaryLayer(descriptor, layerName.c_str());
1209 CHECK(deserializedNetwork);
1212 layerName, { inputInfo, inputInfo }, { outputInfo }, descriptor);
1216 TEST_CASE(
"SerializeLogSoftmax")
1218 const std::string layerName(
"log_softmax");
1222 descriptor.
m_Beta = 1.0f;
1223 descriptor.m_Axis = -1;
1237 CHECK(deserializedNetwork);
1243 TEST_CASE(
"SerializeMaximum")
1245 const std::string layerName(
"maximum");
1263 CHECK(deserializedNetwork);
1269 TEST_CASE(
"SerializeMean")
1271 const std::string layerName(
"mean");
1276 descriptor.
m_Axis = { 2 };
1277 descriptor.m_KeepDims =
true;
1291 CHECK(deserializedNetwork);
1297 TEST_CASE(
"SerializeMerge")
1299 const std::string layerName(
"merge");
1317 CHECK(deserializedNetwork);
1326 MergerLayerVerifier(
const std::string& layerName,
1327 const std::vector<armnn::TensorInfo>& inputInfos,
1328 const std::vector<armnn::TensorInfo>& outputInfos,
1334 const std::vector<armnn::ConstTensor>& constants,
1345 throw armnn::Exception(
"MergerLayer should have translated to ConcatLayer");
1350 VerifyNameAndConnections(layer, name);
1353 VerifyDescriptor(layerDescriptor);
1367 TEST_CASE(
"SerializeMerger")
1369 const std::string layerName(
"merger");
1373 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1388 mergerLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1392 mergerLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1396 CHECK(deserializedNetwork);
1398 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1399 deserializedNetwork->ExecuteStrategy(verifier);
1402 TEST_CASE(
"EnsureMergerLayerBackwardCompatibility")
1409 const std::vector<uint8_t> mergerModel =
1411 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1412 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1413 0x38, 0x02, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1415 0xF4, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1416 0x00, 0x00, 0x9A, 0xFE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x7E, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1417 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1419 0xF8, 0xFE, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1420 0x00, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1421 0x68, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1422 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1423 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1424 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1425 0x00, 0x00, 0x00, 0x00, 0x3E, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1427 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1428 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6D, 0x65, 0x72, 0x67, 0x65, 0x72, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1429 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1430 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1431 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
1432 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1433 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1434 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1435 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1436 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1437 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1438 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1439 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1441 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1442 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1443 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1444 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1445 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1446 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1447 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1448 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1449 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1450 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1451 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1452 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1453 0x02, 0x00, 0x00, 0x00
1457 CHECK(deserializedNetwork);
1462 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1467 MergerLayerVerifier verifier(
"merger", { inputInfo, inputInfo }, { outputInfo }, descriptor);
1468 deserializedNetwork->ExecuteStrategy(verifier);
1471 TEST_CASE(
"SerializeConcat")
1473 const std::string layerName(
"concat");
1477 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1498 CHECK(deserializedNetwork);
1502 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1503 deserializedNetwork->ExecuteStrategy(verifier);
1506 TEST_CASE(
"SerializeMinimum")
1508 const std::string layerName(
"minimum");
1526 CHECK(deserializedNetwork);
1532 TEST_CASE(
"SerializeMultiplication")
1534 const std::string layerName(
"multiplication");
1552 CHECK(deserializedNetwork);
1558 TEST_CASE(
"SerializePrelu")
1560 const std::string layerName(
"prelu");
1581 CHECK(deserializedNetwork);
1583 LayerVerifierBase verifier(layerName, {inputTensorInfo, alphaTensorInfo}, {outputTensorInfo});
1587 TEST_CASE(
"SerializeNormalization")
1589 const std::string layerName(
"normalization");
1594 desc.m_NormSize = 3;
1611 CHECK(deserializedNetwork);
1617 TEST_CASE(
"SerializePad")
1619 const std::string layerName(
"pad");
1637 CHECK(deserializedNetwork);
1646 TEST_CASE(
"EnsurePadBackwardCompatibility")
1654 const std::vector<uint8_t> padModel =
1656 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1657 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1658 0x54, 0x01, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1659 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD0, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1660 0x04, 0x00, 0x00, 0x00, 0x96, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1661 0x00, 0x00, 0x72, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1662 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
1663 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
1664 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x16, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00,
1665 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
1666 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
1667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1668 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
1669 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1670 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00,
1671 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x61, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
1672 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1673 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1674 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
1675 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
1676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00,
1677 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00,
1678 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1679 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00,
1680 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
1681 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
1682 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
1683 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1684 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
1685 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
1689 CHECK(deserializedNetwork);
1700 TEST_CASE(
"SerializePermute")
1702 const std::string layerName(
"permute");
1720 CHECK(deserializedNetwork);
1723 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
1727 TEST_CASE(
"SerializePooling2d")
1729 const std::string layerName(
"pooling2d");
1736 desc.m_PadBottom = 0;
1738 desc.m_PadRight = 0;
1742 desc.m_PoolHeight = 2;
1743 desc.m_PoolWidth = 2;
1759 CHECK(deserializedNetwork);
1762 layerName, {inputInfo}, {outputInfo}, desc);
1766 TEST_CASE(
"SerializeQuantize")
1768 const std::string layerName(
"quantize");
1783 CHECK(deserializedNetwork);
1789 TEST_CASE(
"SerializeRank")
1791 const std::string layerName(
"rank");
1807 CHECK(deserializedNetwork);
1813 TEST_CASE(
"SerializeReduceSum")
1815 const std::string layerName(
"Reduce_Sum");
1835 CHECK(deserializedNetwork);
1841 TEST_CASE(
"SerializeReshape")
1843 const std::string layerName(
"reshape");
1861 CHECK(deserializedNetwork);
1864 layerName, {inputInfo}, {outputInfo}, descriptor);
1868 TEST_CASE(
"SerializeResize")
1870 const std::string layerName(
"resize");
1876 desc.m_TargetHeight = 2;
1878 desc.m_AlignCorners =
true;
1879 desc.m_HalfPixelCenters =
true;
1893 CHECK(deserializedNetwork);
1902 ResizeBilinearLayerVerifier(
const std::string& layerName,
1903 const std::vector<armnn::TensorInfo>& inputInfos,
1904 const std::vector<armnn::TensorInfo>& outputInfos,
1907 layerName, inputInfos, outputInfos, descriptor) {}
1911 const std::vector<armnn::ConstTensor>& constants,
1922 VerifyNameAndConnections(layer, name);
1926 CHECK(layerDescriptor.
m_TargetWidth == m_Descriptor.m_TargetWidth);
1927 CHECK(layerDescriptor.
m_TargetHeight == m_Descriptor.m_TargetHeight);
1928 CHECK(layerDescriptor.
m_DataLayout == m_Descriptor.m_DataLayout);
1929 CHECK(layerDescriptor.
m_AlignCorners == m_Descriptor.m_AlignCorners);
1935 throw armnn::Exception(
"Unexpected layer type in test model. ResizeBiliniar " 1936 "should have translated to Resize");
1945 TEST_CASE(
"SerializeResizeBilinear")
1947 const std::string layerName(
"resizeBilinear");
1953 desc.m_TargetHeight = 2u;
1954 desc.m_AlignCorners =
true;
1955 desc.m_HalfPixelCenters =
true;
1965 resizeLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
1968 resizeLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
1971 CHECK(deserializedNetwork);
1973 ResizeBilinearLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
1974 deserializedNetwork->ExecuteStrategy(verifier);
1977 TEST_CASE(
"EnsureResizeBilinearBackwardCompatibility")
1984 const std::vector<uint8_t> resizeBilinearModel =
1986 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1987 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1988 0x50, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1989 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD4, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1990 0x04, 0x00, 0x00, 0x00, 0xC2, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
1991 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
1992 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1993 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1994 0x38, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
1995 0x00, 0x1A, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1996 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x08, 0x00, 0x0C, 0x00,
1997 0x07, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1998 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00,
1999 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
2000 0x20, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x42, 0x69, 0x6C, 0x69,
2001 0x6E, 0x65, 0x61, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2002 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
2003 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2004 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
2005 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2006 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
2007 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
2008 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00,
2009 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
2010 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00,
2012 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
2013 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2014 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2015 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
2019 DeserializeNetwork(std::string(resizeBilinearModel.begin(), resizeBilinearModel.end()));
2020 CHECK(deserializedNetwork);
2027 descriptor.m_TargetHeight = 2u;
2029 ResizeBilinearLayerVerifier verifier(
"resizeBilinear", { inputInfo }, { outputInfo }, descriptor);
2030 deserializedNetwork->ExecuteStrategy(verifier);
2033 TEST_CASE(
"SerializeShape")
2035 const std::string layerName(
"shape");
2051 CHECK(deserializedNetwork);
2058 TEST_CASE(
"SerializeSlice")
2060 const std::string layerName{
"slice"};
2080 CHECK(deserializedNetwork);
2086 TEST_CASE(
"SerializeSoftmax")
2088 const std::string layerName(
"softmax");
2092 descriptor.
m_Beta = 1.0f;
2106 CHECK(deserializedNetwork);
2112 TEST_CASE(
"SerializeSpaceToBatchNd")
2114 const std::string layerName(
"spaceToBatchNd");
2120 desc.m_BlockShape = {2, 2};
2121 desc.m_PadList = {{0, 0}, {2, 0}};
2135 CHECK(deserializedNetwork);
2138 layerName, {inputInfo}, {outputInfo}, desc);
2142 TEST_CASE(
"SerializeSpaceToDepth")
2144 const std::string layerName(
"spaceToDepth");
2165 CHECK(deserializedNetwork);
2168 layerName, {inputInfo}, {outputInfo}, desc);
2172 TEST_CASE(
"SerializeSplitter")
2174 const unsigned int numViews = 3;
2175 const unsigned int numDimensions = 4;
2176 const unsigned int inputShape[] = {1, 18, 4, 4};
2177 const unsigned int outputShape[] = {1, 6, 4, 4};
2180 unsigned int splitterDimSizes[4] = {
static_cast<unsigned int>(inputShape[0]),
2181 static_cast<unsigned int>(inputShape[1]),
2182 static_cast<unsigned int>(inputShape[2]),
2183 static_cast<unsigned int>(inputShape[3])};
2184 splitterDimSizes[1] /= numViews;
2187 for (
unsigned int g = 0; g < numViews; ++g)
2191 for (
unsigned int dimIdx=0; dimIdx < 4; dimIdx++)
2193 desc.
SetViewSize(g, dimIdx, splitterDimSizes[dimIdx]);
2197 const std::string layerName(
"splitter");
2219 CHECK(deserializedNetwork);
2222 layerName, {inputInfo}, {outputInfo, outputInfo, outputInfo}, desc);
2226 TEST_CASE(
"SerializeStack")
2228 const std::string layerName(
"stack");
2250 CHECK(deserializedNetwork);
2253 layerName, {inputTensorInfo, inputTensorInfo}, {outputTensorInfo}, descriptor);
2257 TEST_CASE(
"SerializeStandIn")
2259 const std::string layerName(
"standIn");
2284 CHECK(deserializedNetwork);
2287 layerName, { tensorInfo, tensorInfo }, { tensorInfo, tensorInfo }, descriptor);
2291 TEST_CASE(
"SerializeStridedSlice")
2293 const std::string layerName(
"stridedSlice");
2297 armnn::StridedSliceDescriptor desc({0, 0, 1, 0}, {1, 1, 1, 1}, {1, 1, 1, 1});
2299 desc.m_ShrinkAxisMask = (1 << 1) | (1 << 2);
2314 CHECK(deserializedNetwork);
2317 layerName, {inputInfo}, {outputInfo}, desc);
2321 TEST_CASE(
"SerializeSubtraction")
2323 const std::string layerName(
"subtraction");
2341 CHECK(deserializedNetwork);
2347 TEST_CASE(
"SerializeSwitch")
2352 SwitchLayerVerifier(
const std::string& layerName,
2353 const std::vector<armnn::TensorInfo>& inputInfos,
2354 const std::vector<armnn::TensorInfo>& outputInfos)
2359 const std::vector<armnn::ConstTensor>& constants,
2371 VerifyNameAndConnections(layer, name);
2382 const std::string layerName(
"switch");
2385 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2406 CHECK(deserializedNetwork);
2408 SwitchLayerVerifier verifier(layerName, {
info,
info}, {info, info});
2409 deserializedNetwork->ExecuteStrategy(verifier);
2412 TEST_CASE(
"SerializeTranspose")
2414 const std::string layerName(
"transpose");
2432 CHECK(deserializedNetwork);
2435 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2439 TEST_CASE(
"SerializeTransposeConvolution2d")
2441 const std::string layerName(
"transposeConvolution2d");
2448 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
2451 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
2467 network->AddTransposeConvolution2dLayer(descriptor,
2480 CHECK(deserializedNetwork);
2482 const std::vector<armnn::ConstTensor> constants {weights, biases};
2484 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
2488 TEST_CASE(
"SerializeDeserializeNonLinearNetwork")
2493 ConstantLayerVerifier(
const std::string& layerName,
2494 const std::vector<armnn::TensorInfo>& inputInfos,
2495 const std::vector<armnn::TensorInfo>& outputInfos,
2498 , m_LayerInput(layerInput) {}
2502 const std::vector<armnn::ConstTensor>& constants,
2514 VerifyNameAndConnections(layer, name);
2529 const std::string layerName(
"constant");
2532 std::vector<float> constantData = GenerateRandomData<float>(
info.GetNumElements());
2550 CHECK(deserializedNetwork);
2552 ConstantLayerVerifier verifier(layerName, {}, {
info}, constTensor);
2553 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)
#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.
uint32_t m_TargetWidth
Target width value.
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
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).
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_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
A ResizeDescriptor for the ResizeLayer.
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.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
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.
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.
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.
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.
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 ResizeBilinearDescriptor for the ResizeBilinearLayer.
static INetworkPtr Create(NetworkOptions networkOptions={})
A SoftmaxDescriptor for the SoftmaxLayer.
Status SetViewOriginCoord(uint32_t view, uint32_t coord, uint32_t value)
Set the view origin coordinates.
A DepthwiseConvolution2dDescriptor for the DepthwiseConvolution2dLayer.
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.