From 3ae3f978cf9ce3174609b7152af87acb410b0fe0 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Fri, 21 May 2021 16:33:48 +0100 Subject: MLCE-510 Add CpuRef Shape Operator to ArmNN * Add front end * Add reference workload * Serialization/Deserialization * Add unit tests * Update ArmNN Versioning Signed-off-by: Keith Davis Change-Id: I6fcb1fa341d6f08dea4003b13544e6e9f53fefd3 --- src/armnnDeserializer/test/DeserializeShape.cpp | 131 ++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 src/armnnDeserializer/test/DeserializeShape.cpp (limited to 'src/armnnDeserializer/test/DeserializeShape.cpp') diff --git a/src/armnnDeserializer/test/DeserializeShape.cpp b/src/armnnDeserializer/test/DeserializeShape.cpp new file mode 100644 index 0000000000..a20fb59699 --- /dev/null +++ b/src/armnnDeserializer/test/DeserializeShape.cpp @@ -0,0 +1,131 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include +#include "ParserFlatbuffersSerializeFixture.hpp" +#include + +#include + +BOOST_AUTO_TEST_SUITE(Deserializer) + +struct ShapeFixture : public ParserFlatbuffersSerializeFixture +{ + explicit ShapeFixture() + { + m_JsonString = R"( + { + layers: [ + { + layer_type: "InputLayer", + layer: { + base: { + base: { + layerName: "InputLayer", + layerType: "Input", + inputSlots: [ + + ], + outputSlots: [ + { + tensorInfo: { + dimensions: [ + 1, + 3, + 3, + 1 + ], + dataType: "Signed32", + quantizationScale: 0.0 + } + } + ] + } + } + } + }, + { + layer_type: "ShapeLayer", + layer: { + base: { + index: 1, + layerName: "shape", + layerType: "Shape", + inputSlots: [ + { + connection: { + sourceLayerIndex: 0, + outputSlotIndex: 0 + } + } + ], + outputSlots: [ + { + tensorInfo: { + dimensions: [ + 4 + ], + dataType: "Signed32", + quantizationScale: 0.0 + } + } + ] + } + } + }, + { + layer_type: "OutputLayer", + layer: { + base: { + base: { + index: 2, + layerName: "OutputLayer", + layerType: "Output", + inputSlots: [ + { + connection: { + sourceLayerIndex: 1, + outputSlotIndex: 0 + } + } + ], + outputSlots: [ + + ] + } + } + } + } + ], + inputIds: [ + 0 + ], + outputIds: [ + 0 + ], + featureVersions: { + bindingIdsScheme: 1 + } + } + )"; + Setup(); + } +}; + + +struct SimpleShapeFixture : ShapeFixture +{ + SimpleShapeFixture() : ShapeFixture() {} +}; + +BOOST_FIXTURE_TEST_CASE(DeserializeShape, SimpleShapeFixture) +{ + RunTest<1, armnn::DataType::Signed32>( + 0, + {{"InputLayer", { 1, 1, 1, 1, 1, 1, 1, 1, 1 }}}, + {{"OutputLayer",{ 1, 3, 3, 1 }}}); +} + +BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1