aboutsummaryrefslogtreecommitdiff
path: root/src/armnnDeserializer/test/DeserializeShape.cpp
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2021-05-21 16:33:48 +0100
committerKeith Davis <keith.davis@arm.com>2021-06-16 17:27:59 +0100
commit3ae3f978cf9ce3174609b7152af87acb410b0fe0 (patch)
tree9c71ea6aafbacfeba6938b5e0e29cdc97a784b70 /src/armnnDeserializer/test/DeserializeShape.cpp
parent50de4fa4e7e0dd02a442ba350a1b40f293cb5a01 (diff)
downloadarmnn-3ae3f978cf9ce3174609b7152af87acb410b0fe0.tar.gz
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 <keith.davis@arm.com> Change-Id: I6fcb1fa341d6f08dea4003b13544e6e9f53fefd3
Diffstat (limited to 'src/armnnDeserializer/test/DeserializeShape.cpp')
-rw-r--r--src/armnnDeserializer/test/DeserializeShape.cpp131
1 files changed, 131 insertions, 0 deletions
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 <boost/test/unit_test.hpp>
+#include "ParserFlatbuffersSerializeFixture.hpp"
+#include <armnnDeserializer/IDeserializer.hpp>
+
+#include <string>
+
+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()