blob: 7d8213cd953edc5837fbe948627c7ff4ff550f5b [file] [log] [blame]
Nattapat Chaimanowong235cea52019-02-28 16:27:30 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <boost/test/unit_test.hpp>
7#include "ParserFlatbuffersSerializeFixture.hpp"
8#include "../Deserializer.hpp"
9
10#include <string>
11#include <iostream>
12
13BOOST_AUTO_TEST_SUITE(Deserializer)
14
15struct EqualFixture : public ParserFlatbuffersSerializeFixture
16{
17 explicit EqualFixture(const std::string & inputShape1,
18 const std::string & inputShape2,
19 const std::string & outputShape,
20 const std::string & dataType)
21 {
22 m_JsonString = R"(
23 {
24 inputIds: [0, 1],
25 outputIds: [3],
26 layers: [
27 {
28 layer_type: "InputLayer",
29 layer: {
30 base: {
31 layerBindingId: 0,
32 base: {
33 index: 0,
34 layerName: "InputLayer1",
35 layerType: "Input",
36 inputSlots: [{
37 index: 0,
38 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
39 }],
40 outputSlots: [{
41 index: 0,
42 tensorInfo: {
43 dimensions: )" + inputShape1 + R"(,
44 dataType: )" + dataType + R"(
45 },
46 }],
47 },
48 }
49 },
50 },
51 {
52 layer_type: "InputLayer",
53 layer: {
54 base: {
55 layerBindingId: 1,
56 base: {
57 index:1,
58 layerName: "InputLayer2",
59 layerType: "Input",
60 inputSlots: [{
61 index: 0,
62 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
63 }],
64 outputSlots: [{
65 index: 0,
66 tensorInfo: {
67 dimensions: )" + inputShape2 + R"(,
68 dataType: )" + dataType + R"(
69 },
70 }],
71 },
72 }
73 },
74 },
75 {
76 layer_type: "EqualLayer",
77 layer: {
78 base: {
79 index:2,
80 layerName: "EqualLayer",
81 layerType: "Equal",
82 inputSlots: [{
83 index: 0,
84 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
85 },
86 {
87 index: 1,
88 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
89 }],
90 outputSlots: [{
91 index: 0,
92 tensorInfo: {
93 dimensions: )" + outputShape + R"(,
94 dataType: Boolean
95 },
96 }],
97 }
98 },
99 },
100 {
101 layer_type: "OutputLayer",
102 layer: {
103 base:{
104 layerBindingId: 0,
105 base: {
106 index: 3,
107 layerName: "OutputLayer",
108 layerType: "Output",
109 inputSlots: [{
110 index: 0,
111 connection: {sourceLayerIndex:2, outputSlotIndex:0 },
112 }],
113 outputSlots: [{
114 index: 0,
115 tensorInfo: {
116 dimensions: )" + outputShape + R"(,
117 dataType: Boolean
118 },
119 }],
120 }
121 }
122 },
123 }
124 ]
125 }
126 )";
127 Setup();
128 }
129};
130
131struct SimpleEqualFixture : EqualFixture
132{
133 SimpleEqualFixture() : EqualFixture("[ 2, 2, 2, 1 ]",
134 "[ 2, 2, 2, 1 ]",
135 "[ 2, 2, 2, 1 ]",
136 "QuantisedAsymm8") {}
137};
138
139BOOST_FIXTURE_TEST_CASE(EqualQuantisedAsymm8, SimpleEqualFixture)
140{
141 RunTest<4, armnn::DataType::QuantisedAsymm8, armnn::DataType::Boolean>(
142 0,
143 {{"InputLayer1", { 0, 1, 2, 3, 4, 5, 6, 7 }},
144 {"InputLayer2", { 0, 0, 0, 3, 0, 0, 6, 7 }}},
145 {{"OutputLayer", { 1, 0, 0, 1, 0, 0, 1, 1 }}});
146}
147
148BOOST_AUTO_TEST_SUITE_END()