aboutsummaryrefslogtreecommitdiff
path: root/src/armnnDeserializer/test/DeserializeShape.cpp
diff options
context:
space:
mode:
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()