blob: a20fb59699990d2d420ae7712827b9bfcc05a70d [file] [log] [blame]
Keith Davis3ae3f972021-05-21 16:33:48 +01001//
2// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <boost/test/unit_test.hpp>
7#include "ParserFlatbuffersSerializeFixture.hpp"
8#include <armnnDeserializer/IDeserializer.hpp>
9
10#include <string>
11
12BOOST_AUTO_TEST_SUITE(Deserializer)
13
14struct ShapeFixture : public ParserFlatbuffersSerializeFixture
15{
16 explicit ShapeFixture()
17 {
18 m_JsonString = R"(
19 {
20 layers: [
21 {
22 layer_type: "InputLayer",
23 layer: {
24 base: {
25 base: {
26 layerName: "InputLayer",
27 layerType: "Input",
28 inputSlots: [
29
30 ],
31 outputSlots: [
32 {
33 tensorInfo: {
34 dimensions: [
35 1,
36 3,
37 3,
38 1
39 ],
40 dataType: "Signed32",
41 quantizationScale: 0.0
42 }
43 }
44 ]
45 }
46 }
47 }
48 },
49 {
50 layer_type: "ShapeLayer",
51 layer: {
52 base: {
53 index: 1,
54 layerName: "shape",
55 layerType: "Shape",
56 inputSlots: [
57 {
58 connection: {
59 sourceLayerIndex: 0,
60 outputSlotIndex: 0
61 }
62 }
63 ],
64 outputSlots: [
65 {
66 tensorInfo: {
67 dimensions: [
68 4
69 ],
70 dataType: "Signed32",
71 quantizationScale: 0.0
72 }
73 }
74 ]
75 }
76 }
77 },
78 {
79 layer_type: "OutputLayer",
80 layer: {
81 base: {
82 base: {
83 index: 2,
84 layerName: "OutputLayer",
85 layerType: "Output",
86 inputSlots: [
87 {
88 connection: {
89 sourceLayerIndex: 1,
90 outputSlotIndex: 0
91 }
92 }
93 ],
94 outputSlots: [
95
96 ]
97 }
98 }
99 }
100 }
101 ],
102 inputIds: [
103 0
104 ],
105 outputIds: [
106 0
107 ],
108 featureVersions: {
109 bindingIdsScheme: 1
110 }
111 }
112 )";
113 Setup();
114 }
115};
116
117
118struct SimpleShapeFixture : ShapeFixture
119{
120 SimpleShapeFixture() : ShapeFixture() {}
121};
122
123BOOST_FIXTURE_TEST_CASE(DeserializeShape, SimpleShapeFixture)
124{
125 RunTest<1, armnn::DataType::Signed32>(
126 0,
127 {{"InputLayer", { 1, 1, 1, 1, 1, 1, 1, 1, 1 }}},
128 {{"OutputLayer",{ 1, 3, 3, 1 }}});
129}
130
131BOOST_AUTO_TEST_SUITE_END()