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);
340 Convolution2dLayerVerifier(
const std::string& layerName,
341 const std::vector<armnn::TensorInfo>& inputInfos,
342 const std::vector<armnn::TensorInfo>& outputInfos,
343 const Convolution2dDescriptor& descriptor)
348 const std::vector<armnn::ConstTensor>& constants,
360 VerifyNameAndConnections(layer, name);
361 const Convolution2dDescriptor& layerDescriptor =
362 static_cast<const Convolution2dDescriptor&
>(descriptor);
363 CHECK(layerDescriptor.m_BiasEnabled == m_Descriptor.m_BiasEnabled);
369 TEST_CASE(
"SerializeConvolution2d")
371 const std::string layerName(
"convolution2d");
378 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
381 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
400 network->AddConvolution2dLayer(descriptor,
408 convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
411 convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
414 CHECK(deserializedNetwork);
416 Convolution2dLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
417 deserializedNetwork->ExecuteStrategy(verifier);
420 TEST_CASE(
"SerializeConvolution2dWithPerAxisParams")
422 using namespace armnn;
424 const std::string layerName(
"convolution2dWithPerAxis");
425 const TensorInfo inputInfo ({ 1, 3, 1, 2 }, DataType::QAsymmU8, 0.55f, 128);
426 const TensorInfo outputInfo({ 1, 3, 1, 3 }, DataType::QAsymmU8, 0.75f, 128);
428 const std::vector<float> quantScales{ 0.75f, 0.65f, 0.85f };
429 constexpr
unsigned int quantDimension = 0;
431 const TensorInfo kernelInfo({ 3, 1, 1, 2 }, DataType::QSymmS8, quantScales, quantDimension,
true);
433 const std::vector<float> biasQuantScales{ 0.25f, 0.50f, 0.75f };
434 const TensorInfo biasInfo({ 3 }, DataType::Signed32, biasQuantScales, quantDimension,
true);
436 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
438 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
441 Convolution2dDescriptor descriptor;
443 descriptor.m_StrideY = 1;
444 descriptor.m_PadLeft = 0;
445 descriptor.m_PadRight = 0;
446 descriptor.m_PadTop = 0;
447 descriptor.m_PadBottom = 0;
448 descriptor.m_BiasEnabled =
true;
455 network->AddConvolution2dLayer(descriptor,
463 convLayer->GetOutputSlot(0).Connect(outputLayer->GetInputSlot(0));
466 convLayer->GetOutputSlot(0).SetTensorInfo(outputInfo);
469 CHECK(deserializedNetwork);
471 Convolution2dLayerVerifier verifier(layerName, {inputInfo, kernelInfo, biasInfo}, {outputInfo}, descriptor);
473 deserializedNetwork->ExecuteStrategy(verifier);
476 TEST_CASE(
"SerializeConvolution2dWeightsAndBiasesAsConstantLayers")
478 const std::string layerName(
"convolution2d");
485 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
488 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
522 CHECK(deserializedNetwork);
524 Convolution2dLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
526 deserializedNetwork->ExecuteStrategy(verifier);
529 TEST_CASE(
"SerializeConvolution2dWeightsAndBiasesAsConstantLayers")
531 const std::string layerName(
"convolution2d");
538 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
541 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
575 CHECK(deserializedNetwork);
577 const std::vector<armnn::ConstTensor>& constants {weights, biases};
579 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
584 TEST_CASE(
"SerializeConvolution3d")
586 const std::string layerName(
"convolution3d");
593 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
596 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
633 CHECK(deserializedNetwork);
636 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
640 TEST_CASE(
"SerializeDepthToSpace")
642 const std::string layerName(
"depthToSpace");
663 CHECK(deserializedNetwork);
669 TEST_CASE(
"SerializeDepthwiseConvolution2d")
671 const std::string layerName(
"depwiseConvolution2d");
678 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
681 std::vector<int32_t> biasesData = GenerateRandomData<int32_t>(biasesInfo.GetNumElements());
717 CHECK(deserializedNetwork);
719 const std::vector<armnn::ConstTensor>& constants {weights, biases};
721 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
725 TEST_CASE(
"SerializeDepthwiseConvolution2dWithPerAxisParams")
727 using namespace armnn;
729 const std::string layerName(
"depwiseConvolution2dWithPerAxis");
730 const TensorInfo inputInfo ({ 1, 3, 3, 2 }, DataType::QAsymmU8, 0.55f, 128);
731 const TensorInfo outputInfo({ 1, 2, 2, 4 }, DataType::QAsymmU8, 0.75f, 128);
733 const std::vector<float> quantScales{ 0.75f, 0.80f, 0.90f, 0.95f };
734 const unsigned int quantDimension = 0;
735 TensorInfo kernelInfo({ 2, 2, 2, 2 }, DataType::QSymmS8, quantScales, quantDimension,
true);
737 const std::vector<float> biasQuantScales{ 0.25f, 0.35f, 0.45f, 0.55f };
738 constexpr
unsigned int biasQuantDimension = 0;
739 TensorInfo biasInfo({ 4 }, DataType::Signed32, biasQuantScales, biasQuantDimension,
true);
741 std::vector<int8_t> kernelData = GenerateRandomData<int8_t>(kernelInfo.GetNumElements());
743 std::vector<int32_t> biasData = GenerateRandomData<int32_t>(biasInfo.GetNumElements());
779 CHECK(deserializedNetwork);
781 const std::vector<armnn::ConstTensor>& constants {weights, biases};
783 layerName, {inputInfo, kernelInfo, biasInfo}, {outputInfo}, descriptor, constants);
787 TEST_CASE(
"SerializeDepthwiseConvolution2dWeightsAndBiasesAsConstantLayers")
789 const std::string layerName(
"depthwiseConvolution2d");
796 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
799 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
833 CHECK(deserializedNetwork);
835 const std::vector<armnn::ConstTensor>& constants {weights, biases};
837 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
842 TEST_CASE(
"SerializeDequantize")
844 const std::string layerName(
"dequantize");
860 CHECK(deserializedNetwork);
866 TEST_CASE(
"SerializeDeserializeDetectionPostProcess")
868 const std::string layerName(
"detectionPostProcess");
870 const std::vector<armnn::TensorInfo> inputInfos({
875 const std::vector<armnn::TensorInfo> outputInfos({
896 const std::vector<float> anchorsData({
897 0.5f, 0.5f, 1.0f, 1.0f,
898 0.5f, 0.5f, 1.0f, 1.0f,
899 0.5f, 0.5f, 1.0f, 1.0f,
900 0.5f, 10.5f, 1.0f, 1.0f,
901 0.5f, 10.5f, 1.0f, 1.0f,
902 0.5f, 100.5f, 1.0f, 1.0f
908 network->AddDetectionPostProcessLayer(descriptor, anchors, layerName.c_str());
910 for (
unsigned int i = 0; i < 2; i++)
917 for (
unsigned int i = 0; i < 4; i++)
925 CHECK(deserializedNetwork);
927 const std::vector<armnn::ConstTensor>& constants {anchors};
929 layerName, inputInfos, outputInfos, descriptor, constants);
930 deserializedNetwork->ExecuteStrategy(verifier);
933 TEST_CASE(
"SerializeDivision")
935 const std::string layerName(
"division");
953 CHECK(deserializedNetwork);
959 TEST_CASE(
"SerializeDeserializeComparisonEqual")
961 const std::string layerName(
"EqualLayer");
981 CHECK(deserializedNetwork);
983 LayerVerifierBase verifier(layerName, {inputTensorInfo1, inputTensorInfo2}, {outputTensorInfo});
1001 network->AddElementwiseUnaryLayer(descriptor, layerName);
1012 CHECK(deserializedNetwork);
1015 verifier(layerName, { inputInfo }, { outputInfo }, descriptor);
1020 TEST_CASE(
"SerializeElementwiseUnary")
1023 std::initializer_list<op> allUnaryOperations = {op::Abs, op::Exp, op::Sqrt, op::Rsqrt, op::Neg,
1024 op::LogicalNot, op::Log, op::Sin};
1026 for (
auto unaryOperation : allUnaryOperations)
1028 SerializeElementwiseUnaryTest(unaryOperation);
1032 TEST_CASE(
"SerializeFill")
1034 const std::string layerName(
"fill");
1052 CHECK(deserializedNetwork);
1059 TEST_CASE(
"SerializeFloor")
1061 const std::string layerName(
"floor");
1076 CHECK(deserializedNetwork);
1086 FullyConnectedLayerVerifier(
const std::string& layerName,
1087 const std::vector<armnn::TensorInfo>& inputInfos,
1088 const std::vector<armnn::TensorInfo>& outputInfos,
1094 const std::vector<armnn::ConstTensor>& constants,
1106 VerifyNameAndConnections(layer, name);
1110 CHECK(layerDescriptor.
m_BiasEnabled == m_Descriptor.m_BiasEnabled);
1117 TEST_CASE(
"SerializeFullyConnected")
1119 const std::string layerName(
"fullyConnected");
1125 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
1126 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
1140 network->AddFullyConnectedLayer(descriptor,
1155 CHECK(deserializedNetwork);
1157 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
1158 deserializedNetwork->ExecuteStrategy(verifier);
1161 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsInputs")
1163 const std::string layerName(
"fullyConnected_weights_as_inputs");
1183 network->AddFullyConnectedLayer(descriptor,
1198 CHECK(deserializedNetwork);
1200 const std::vector<armnn::ConstTensor> constants {};
1202 layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor, constants);
1206 TEST_CASE(
"SerializeFullyConnectedWeightsAndBiasesAsConstantLayers")
1208 const std::string layerName(
"fullyConnected_weights_as_inputs");
1215 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
1216 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
1229 armnn::IConnectableLayer*
const fullyConnectedLayer = network->AddFullyConnectedLayer(descriptor,layerName.c_str());
1243 CHECK(deserializedNetwork);
1245 FullyConnectedLayerVerifier verifier(layerName, {inputInfo, weightsInfo, biasesInfo}, {outputInfo}, descriptor);
1246 deserializedNetwork->ExecuteStrategy(verifier);
1249 TEST_CASE(
"SerializeGather")
1255 GatherLayerVerifier(
const std::string& layerName,
1256 const std::vector<armnn::TensorInfo>& inputInfos,
1257 const std::vector<armnn::TensorInfo>& outputInfos,
1263 const std::vector<armnn::ConstTensor>& constants,
1275 VerifyNameAndConnections(layer, name);
1277 CHECK(layerDescriptor.
m_Axis == m_Descriptor.m_Axis);
1283 const std::string layerName(
"gather");
1288 descriptor.m_Axis = 1;
1290 paramsInfo.SetQuantizationScale(1.0f);
1291 paramsInfo.SetQuantizationOffset(0);
1295 const std::vector<int32_t>& indicesData = {7, 6, 5};
1313 CHECK(deserializedNetwork);
1315 GatherLayerVerifier verifier(layerName, {paramsInfo, indicesInfo}, {outputInfo}, descriptor);
1316 deserializedNetwork->ExecuteStrategy(verifier);
1319 TEST_CASE(
"SerializeGatherNd")
1324 GatherNdLayerVerifier(
const std::string& layerName,
1325 const std::vector<armnn::TensorInfo>& inputInfos,
1326 const std::vector<armnn::TensorInfo>& outputInfos)
1331 const std::vector<armnn::ConstTensor>& constants,
1344 VerifyNameAndConnections(layer, name);
1350 const std::string layerName(
"gatherNd");
1356 paramsInfo.SetQuantizationOffset(0);
1360 const std::vector<int32_t>& indicesData = {5, 1, 0};
1378 CHECK(deserializedNetwork);
1380 GatherNdLayerVerifier verifier(layerName, {paramsInfo, indicesInfo}, {outputInfo});
1381 deserializedNetwork->ExecuteStrategy(verifier);
1384 TEST_CASE(
"SerializeComparisonGreater")
1386 const std::string layerName(
"greater");
1409 CHECK(deserializedNetwork);
1411 LayerVerifierBase verifier(layerName, { inputInfo, inputInfo }, { outputInfo });
1416 TEST_CASE(
"SerializeInstanceNormalization")
1418 const std::string layerName(
"instanceNormalization");
1423 descriptor.m_Beta = 0.1f;
1424 descriptor.m_Eps = 0.0001f;
1430 network->AddInstanceNormalizationLayer(descriptor, layerName.c_str());
1440 CHECK(deserializedNetwork);
1443 layerName, {info}, {info}, descriptor);
1447 TEST_CASE(
"SerializeL2Normalization")
1449 const std::string l2NormLayerName(
"l2Normalization");
1454 desc.m_Eps = 0.0001f;
1468 CHECK(deserializedNetwork);
1471 l2NormLayerName, {info}, {info}, desc);
1475 TEST_CASE(
"EnsureL2NormalizationBackwardCompatibility")
1482 const std::vector<uint8_t> l2NormalizationModel =
1484 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1485 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1486 0x3C, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1487 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xE8, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
1488 0x04, 0x00, 0x00, 0x00, 0xD6, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
1489 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
1490 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1491 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1492 0x4C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
1493 0x00, 0x20, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1494 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1495 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1496 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x20, 0x00,
1497 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x6C, 0x32, 0x4E, 0x6F, 0x72, 0x6D, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74,
1498 0x69, 0x6F, 0x6E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00,
1499 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1500 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
1501 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
1502 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1503 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1504 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1505 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1506 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1507 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1508 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1509 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1510 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1511 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1512 0x05, 0x00, 0x00, 0x00, 0x00
1516 DeserializeNetwork(std::string(l2NormalizationModel.begin(), l2NormalizationModel.end()));
1517 CHECK(deserializedNetwork);
1519 const std::string layerName(
"l2Normalization");
1525 desc.m_Eps = 1e-12f;
1528 layerName, {inputInfo}, {inputInfo}, desc);
1532 TEST_CASE(
"SerializeLogicalBinary")
1534 const std::string layerName(
"logicalBinaryAnd");
1546 armnn::IConnectableLayer*
const logicalBinaryLayer = network->AddLogicalBinaryLayer(descriptor, layerName.c_str());
1558 CHECK(deserializedNetwork);
1561 layerName, { inputInfo, inputInfo }, { outputInfo }, descriptor);
1565 TEST_CASE(
"SerializeLogSoftmax")
1567 const std::string layerName(
"log_softmax");
1571 descriptor.
m_Beta = 1.0f;
1572 descriptor.m_Axis = -1;
1586 CHECK(deserializedNetwork);
1592 TEST_CASE(
"SerializeMaximum")
1594 const std::string layerName(
"maximum");
1612 CHECK(deserializedNetwork);
1618 TEST_CASE(
"SerializeMean")
1620 const std::string layerName(
"mean");
1625 descriptor.
m_Axis = { 2 };
1626 descriptor.m_KeepDims =
true;
1640 CHECK(deserializedNetwork);
1646 TEST_CASE(
"SerializeMerge")
1648 const std::string layerName(
"merge");
1666 CHECK(deserializedNetwork);
1675 MergerLayerVerifier(
const std::string& layerName,
1676 const std::vector<armnn::TensorInfo>& inputInfos,
1677 const std::vector<armnn::TensorInfo>& outputInfos,
1683 const std::vector<armnn::ConstTensor>& constants,
1694 throw armnn::Exception(
"MergerLayer should have translated to ConcatLayer");
1699 VerifyNameAndConnections(layer, name);
1702 VerifyDescriptor(layerDescriptor);
1713 TEST_CASE(
"EnsureMergerLayerBackwardCompatibility")
1720 const std::vector<uint8_t> mergerModel =
1722 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1723 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1724 0x38, 0x02, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00,
1725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1726 0xF4, 0xFD, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x04, 0x00,
1727 0x00, 0x00, 0x9A, 0xFE, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x7E, 0xFE, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
1728 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
1729 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1730 0xF8, 0xFE, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xFE, 0xFF, 0xFF, 0x00, 0x00,
1731 0x00, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1732 0x68, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
1733 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
1734 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
1735 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1736 0x00, 0x00, 0x00, 0x00, 0x3E, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1737 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xFF, 0xFF, 0xFF,
1738 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x00,
1739 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6D, 0x65, 0x72, 0x67, 0x65, 0x72, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1740 0x5C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0xFF,
1741 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x92, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
1742 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00,
1743 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
1744 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00,
1745 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1746 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
1747 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00,
1748 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1749 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
1750 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00,
1751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
1752 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
1753 0x00, 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1754 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
1755 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
1756 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00,
1757 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00,
1758 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00,
1759 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1760 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00,
1761 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00,
1762 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
1763 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
1764 0x02, 0x00, 0x00, 0x00
1768 CHECK(deserializedNetwork);
1773 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1778 MergerLayerVerifier verifier(
"merger", { inputInfo, inputInfo }, { outputInfo }, descriptor);
1779 deserializedNetwork->ExecuteStrategy(verifier);
1782 TEST_CASE(
"SerializeConcat")
1784 const std::string layerName(
"concat");
1788 const std::vector<armnn::TensorShape> shapes({inputInfo.
GetShape(), inputInfo.
GetShape()});
1809 CHECK(deserializedNetwork);
1813 MergerLayerVerifier verifier(layerName, {inputInfo, inputInfo}, {outputInfo}, descriptor);
1814 deserializedNetwork->ExecuteStrategy(verifier);
1817 TEST_CASE(
"SerializeMinimum")
1819 const std::string layerName(
"minimum");
1837 CHECK(deserializedNetwork);
1843 TEST_CASE(
"SerializeMultiplication")
1845 const std::string layerName(
"multiplication");
1863 CHECK(deserializedNetwork);
1869 TEST_CASE(
"SerializePrelu")
1871 const std::string layerName(
"prelu");
1892 CHECK(deserializedNetwork);
1894 LayerVerifierBase verifier(layerName, {inputTensorInfo, alphaTensorInfo}, {outputTensorInfo});
1898 TEST_CASE(
"SerializeNormalization")
1900 const std::string layerName(
"normalization");
1905 desc.m_NormSize = 3;
1922 CHECK(deserializedNetwork);
1928 TEST_CASE(
"SerializePad")
1930 const std::string layerName(
"pad");
1948 CHECK(deserializedNetwork);
1957 TEST_CASE(
"SerializePadReflect")
1959 const std::string layerName(
"padReflect");
1978 CHECK(deserializedNetwork);
1987 TEST_CASE(
"EnsurePadBackwardCompatibility")
1995 const std::vector<uint8_t> padModel =
1997 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
1998 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1999 0x54, 0x01, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2000 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD0, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2001 0x04, 0x00, 0x00, 0x00, 0x96, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x9E, 0xFF, 0xFF, 0xFF, 0x04, 0x00,
2002 0x00, 0x00, 0x72, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2003 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
2004 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
2005 0x00, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x16, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00,
2006 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
2007 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
2008 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2009 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
2010 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00, 0x00, 0x00,
2011 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00,
2012 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x70, 0x61, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
2013 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00,
2014 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2015 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2016 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00,
2017 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00,
2018 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00,
2019 0x00, 0x00, 0x06, 0x00, 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2020 0x0E, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00,
2021 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
2022 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
2023 0x08, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
2024 0x0A, 0x00, 0x10, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
2025 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00,
2026 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
2030 CHECK(deserializedNetwork);
2041 TEST_CASE(
"SerializePermute")
2043 const std::string layerName(
"permute");
2061 CHECK(deserializedNetwork);
2064 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2068 TEST_CASE(
"SerializePooling2d")
2070 const std::string layerName(
"pooling2d");
2077 desc.m_PadBottom = 0;
2079 desc.m_PadRight = 0;
2083 desc.m_PoolHeight = 2;
2084 desc.m_PoolWidth = 2;
2100 CHECK(deserializedNetwork);
2103 layerName, {inputInfo}, {outputInfo}, desc);
2107 TEST_CASE(
"SerializePooling3d")
2109 const std::string layerName(
"pooling3d");
2115 desc.m_PadFront = 0;
2118 desc.m_PadBottom = 0;
2120 desc.m_PadRight = 0;
2124 desc.m_PoolHeight = 2;
2125 desc.m_PoolWidth = 2;
2126 desc.m_PoolDepth = 2;
2143 CHECK(deserializedNetwork);
2146 layerName, {inputInfo}, {outputInfo}, desc);
2150 TEST_CASE(
"SerializeQuantize")
2152 const std::string layerName(
"quantize");
2167 CHECK(deserializedNetwork);
2173 TEST_CASE(
"SerializeRank")
2175 const std::string layerName(
"rank");
2191 CHECK(deserializedNetwork);
2197 TEST_CASE(
"SerializeReduceSum")
2199 const std::string layerName(
"Reduce_Sum");
2219 CHECK(deserializedNetwork);
2225 TEST_CASE(
"SerializeReshape")
2227 const std::string layerName(
"reshape");
2245 CHECK(deserializedNetwork);
2248 layerName, {inputInfo}, {outputInfo}, descriptor);
2252 TEST_CASE(
"SerializeResize")
2254 const std::string layerName(
"resize");
2260 desc.m_TargetHeight = 2;
2262 desc.m_AlignCorners =
true;
2263 desc.m_HalfPixelCenters =
true;
2277 CHECK(deserializedNetwork);
2286 ResizeBilinearLayerVerifier(
const std::string& layerName,
2287 const std::vector<armnn::TensorInfo>& inputInfos,
2288 const std::vector<armnn::TensorInfo>& outputInfos,
2291 layerName, inputInfos, outputInfos, descriptor) {}
2295 const std::vector<armnn::ConstTensor>& constants,
2306 VerifyNameAndConnections(layer, name);
2310 CHECK(layerDescriptor.
m_TargetWidth == m_Descriptor.m_TargetWidth);
2311 CHECK(layerDescriptor.
m_TargetHeight == m_Descriptor.m_TargetHeight);
2312 CHECK(layerDescriptor.
m_DataLayout == m_Descriptor.m_DataLayout);
2313 CHECK(layerDescriptor.
m_AlignCorners == m_Descriptor.m_AlignCorners);
2319 throw armnn::Exception(
"Unexpected layer type in test model. ResizeBiliniar " 2320 "should have translated to Resize");
2326 TEST_CASE(
"SerializeResizeBilinear")
2328 const std::string layerName(
"resizeBilinear");
2334 desc.m_TargetWidth = 4u;
2335 desc.m_TargetHeight = 2u;
2336 desc.m_AlignCorners =
true;
2337 desc.m_HalfPixelCenters =
true;
2351 CHECK(deserializedNetwork);
2353 ResizeBilinearLayerVerifier verifier(layerName, {inputInfo}, {outputInfo}, desc);
2354 deserializedNetwork->ExecuteStrategy(verifier);
2357 TEST_CASE(
"EnsureResizeBilinearBackwardCompatibility")
2364 const std::vector<uint8_t> resizeBilinearModel =
2366 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x0A, 0x00,
2367 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
2368 0x50, 0x01, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
2369 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xD4, 0xFE, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x0B,
2370 0x04, 0x00, 0x00, 0x00, 0xC2, 0xFE, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00,
2371 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x8A, 0xFF, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00,
2372 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
2373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2374 0x38, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
2375 0x00, 0x1A, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
2376 0x34, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x12, 0x00, 0x08, 0x00, 0x0C, 0x00,
2377 0x07, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
2378 0x00, 0x00, 0x0E, 0x00, 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0E, 0x00,
2379 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
2380 0x20, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x69, 0x7A, 0x65, 0x42, 0x69, 0x6C, 0x69,
2381 0x6E, 0x65, 0x61, 0x72, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
2382 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00,
2383 0x00, 0x00, 0x52, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2384 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
2385 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2386 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
2387 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0xFF, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
2388 0x0A, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x14, 0x00,
2389 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
2390 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0A, 0x00,
2392 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x10, 0x00,
2393 0x08, 0x00, 0x07, 0x00, 0x0C, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00,
2394 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00,
2395 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
2399 DeserializeNetwork(std::string(resizeBilinearModel.begin(), resizeBilinearModel.end()));
2400 CHECK(deserializedNetwork);
2407 descriptor.m_TargetHeight = 2u;
2409 ResizeBilinearLayerVerifier verifier(
"resizeBilinear", { inputInfo }, { outputInfo }, descriptor);
2410 deserializedNetwork->ExecuteStrategy(verifier);
2413 TEST_CASE(
"SerializeShape")
2415 const std::string layerName(
"shape");
2431 CHECK(deserializedNetwork);
2438 TEST_CASE(
"SerializeSlice")
2440 const std::string layerName{
"slice"};
2460 CHECK(deserializedNetwork);
2466 TEST_CASE(
"SerializeSoftmax")
2468 const std::string layerName(
"softmax");
2472 descriptor.
m_Beta = 1.0f;
2486 CHECK(deserializedNetwork);
2492 TEST_CASE(
"SerializeSpaceToBatchNd")
2494 const std::string layerName(
"spaceToBatchNd");
2500 desc.m_BlockShape = {2, 2};
2501 desc.m_PadList = {{0, 0}, {2, 0}};
2515 CHECK(deserializedNetwork);
2518 layerName, {inputInfo}, {outputInfo}, desc);
2522 TEST_CASE(
"SerializeSpaceToDepth")
2524 const std::string layerName(
"spaceToDepth");
2545 CHECK(deserializedNetwork);
2548 layerName, {inputInfo}, {outputInfo}, desc);
2552 TEST_CASE(
"SerializeSplitter")
2554 const unsigned int numViews = 3;
2555 const unsigned int numDimensions = 4;
2556 const unsigned int inputShape[] = {1, 18, 4, 4};
2557 const unsigned int outputShape[] = {1, 6, 4, 4};
2560 unsigned int splitterDimSizes[4] = {
static_cast<unsigned int>(inputShape[0]),
2561 static_cast<unsigned int>(inputShape[1]),
2562 static_cast<unsigned int>(inputShape[2]),
2563 static_cast<unsigned int>(inputShape[3])};
2564 splitterDimSizes[1] /= numViews;
2567 for (
unsigned int g = 0; g < numViews; ++g)
2569 desc.SetViewOriginCoord(g, 1, splitterDimSizes[1] * g);
2571 for (
unsigned int dimIdx=0; dimIdx < 4; dimIdx++)
2573 desc.SetViewSize(g, dimIdx, splitterDimSizes[dimIdx]);
2577 const std::string layerName(
"splitter");
2599 CHECK(deserializedNetwork);
2602 layerName, {inputInfo}, {outputInfo, outputInfo, outputInfo}, desc);
2606 TEST_CASE(
"SerializeStack")
2608 const std::string layerName(
"stack");
2630 CHECK(deserializedNetwork);
2633 layerName, {inputTensorInfo, inputTensorInfo}, {outputTensorInfo}, descriptor);
2637 TEST_CASE(
"SerializeStandIn")
2639 const std::string layerName(
"standIn");
2664 CHECK(deserializedNetwork);
2667 layerName, { tensorInfo, tensorInfo }, { tensorInfo, tensorInfo }, descriptor);
2671 TEST_CASE(
"SerializeStridedSlice")
2673 const std::string layerName(
"stridedSlice");
2677 armnn::StridedSliceDescriptor desc({0, 0, 1, 0}, {1, 1, 1, 1}, {1, 1, 1, 1});
2679 desc.m_ShrinkAxisMask = (1 << 1) | (1 << 2);
2694 CHECK(deserializedNetwork);
2697 layerName, {inputInfo}, {outputInfo}, desc);
2701 TEST_CASE(
"SerializeSubtraction")
2703 const std::string layerName(
"subtraction");
2721 CHECK(deserializedNetwork);
2727 TEST_CASE(
"SerializeSwitch")
2732 SwitchLayerVerifier(
const std::string& layerName,
2733 const std::vector<armnn::TensorInfo>& inputInfos,
2734 const std::vector<armnn::TensorInfo>& outputInfos)
2739 const std::vector<armnn::ConstTensor>& constants,
2751 VerifyNameAndConnections(layer, name);
2762 const std::string layerName(
"switch");
2765 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
2786 CHECK(deserializedNetwork);
2788 SwitchLayerVerifier verifier(layerName, {info, info}, {info, info});
2789 deserializedNetwork->ExecuteStrategy(verifier);
2792 TEST_CASE(
"SerializeTranspose")
2794 const std::string layerName(
"transpose");
2812 CHECK(deserializedNetwork);
2815 layerName, {inputTensorInfo}, {outputTensorInfo}, descriptor);
2819 TEST_CASE(
"SerializeTransposeConvolution2d")
2821 const std::string layerName(
"transposeConvolution2d");
2828 std::vector<float> weightsData = GenerateRandomData<float>(weightsInfo.GetNumElements());
2831 std::vector<float> biasesData = GenerateRandomData<float>(biasesInfo.GetNumElements());
2847 network->AddTransposeConvolution2dLayer(descriptor,
2860 CHECK(deserializedNetwork);
2862 const std::vector<armnn::ConstTensor> constants {weights, biases};
2864 layerName, {inputInfo}, {outputInfo}, descriptor, constants);
2868 TEST_CASE(
"SerializeDeserializeNonLinearNetwork")
2873 ConstantLayerVerifier(
const std::string& layerName,
2874 const std::vector<armnn::TensorInfo>& inputInfos,
2875 const std::vector<armnn::TensorInfo>& outputInfos,
2878 , m_LayerInput(layerInput) {}
2882 const std::vector<armnn::ConstTensor>& constants,
2894 VerifyNameAndConnections(layer, name);
2909 const std::string layerName(
"constant");
2912 std::vector<float> constantData = GenerateRandomData<float>(info.GetNumElements());
2930 CHECK(deserializedNetwork);
2932 ConstantLayerVerifier verifier(layerName, {}, {info}, constTensor);
2933 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.
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.
void SetQuantizationScale(float scale)
A StandInDescriptor for the StandIn layer.
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.
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.
void SetQuantizationOffset(int32_t offset)
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.
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.