blob: 5d5e04e7a4d341bde33d0ff8e7146f5af9ef6416 [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
Keith Davis3ae3f972021-05-21 16:33:48 +01006#include "ParserFlatbuffersSerializeFixture.hpp"
7#include <armnnDeserializer/IDeserializer.hpp>
8
Matthew Sloyan7a00eaa2021-06-20 18:45:05 +01009#include <doctest/doctest.h>
10
Keith Davis3ae3f972021-05-21 16:33:48 +010011#include <string>
12
Matthew Sloyan7a00eaa2021-06-20 18:45:05 +010013TEST_SUITE("Deserializer_Shape")
14{
Keith Davis3ae3f972021-05-21 16:33:48 +010015struct ShapeFixture : public ParserFlatbuffersSerializeFixture
16{
17 explicit ShapeFixture()
18 {
19 m_JsonString = R"(
20 {
21 layers: [
22 {
23 layer_type: "InputLayer",
24 layer: {
25 base: {
26 base: {
27 layerName: "InputLayer",
28 layerType: "Input",
29 inputSlots: [
30
31 ],
32 outputSlots: [
33 {
34 tensorInfo: {
35 dimensions: [
36 1,
37 3,
38 3,
39 1
40 ],
41 dataType: "Signed32",
42 quantizationScale: 0.0
43 }
44 }
45 ]
46 }
47 }
48 }
49 },
50 {
51 layer_type: "ShapeLayer",
52 layer: {
53 base: {
54 index: 1,
55 layerName: "shape",
56 layerType: "Shape",
57 inputSlots: [
58 {
59 connection: {
60 sourceLayerIndex: 0,
61 outputSlotIndex: 0
62 }
63 }
64 ],
65 outputSlots: [
66 {
67 tensorInfo: {
68 dimensions: [
69 4
70 ],
71 dataType: "Signed32",
72 quantizationScale: 0.0
73 }
74 }
75 ]
76 }
77 }
78 },
79 {
80 layer_type: "OutputLayer",
81 layer: {
82 base: {
83 base: {
84 index: 2,
85 layerName: "OutputLayer",
86 layerType: "Output",
87 inputSlots: [
88 {
89 connection: {
90 sourceLayerIndex: 1,
91 outputSlotIndex: 0
92 }
93 }
94 ],
95 outputSlots: [
96
97 ]
98 }
99 }
100 }
101 }
102 ],
103 inputIds: [
104 0
105 ],
106 outputIds: [
107 0
108 ],
109 featureVersions: {
110 bindingIdsScheme: 1
111 }
112 }
113 )";
114 Setup();
115 }
116};
117
Keith Davis3ae3f972021-05-21 16:33:48 +0100118struct SimpleShapeFixture : ShapeFixture
119{
120 SimpleShapeFixture() : ShapeFixture() {}
121};
122
Matthew Sloyan7a00eaa2021-06-20 18:45:05 +0100123TEST_CASE_FIXTURE(SimpleShapeFixture, "DeserializeShape")
Keith Davis3ae3f972021-05-21 16:33:48 +0100124{
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
Matthew Sloyan7a00eaa2021-06-20 18:45:05 +0100131}