ArmNN
 22.05
DeserializePad.cpp File Reference

Go to the source code of this file.

Functions

 TEST_SUITE ("Deserializer_Pad")
 

Function Documentation

◆ TEST_SUITE()

TEST_SUITE ( "Deserializer_Pad"  )

Definition at line 11 of file DeserializePad.cpp.

References ParserFlatbuffersSerializeFixture::SetupSingleInputSingleOutput(), and TEST_CASE_FIXTURE().

12 {
13 struct PadFixture : public ParserFlatbuffersSerializeFixture
14 {
15  explicit PadFixture(const std::string& inputShape,
16  const std::string& padList,
17  const std::string& outputShape,
18  const std::string& dataType,
19  const std::string& paddingMode)
20  {
21  m_JsonString = R"(
22  {
23  inputIds: [0],
24  outputIds: [2],
25  layers: [
26  {
27  layer_type: "InputLayer",
28  layer: {
29  base: {
30  layerBindingId: 0,
31  base: {
32  index: 0,
33  layerName: "InputLayer",
34  layerType: "Input",
35  inputSlots: [{
36  index: 0,
37  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
38  }],
39  outputSlots: [{
40  index: 0,
41  tensorInfo: {
42  dimensions: )" + inputShape + R"(,
43  dataType: )" + dataType + R"(
44  }
45  }]
46  }
47  }
48  }
49  },
50  {
51  layer_type: "PadLayer",
52  layer: {
53  base: {
54  index: 1,
55  layerName: "PadLayer",
56  layerType: "Pad",
57  inputSlots: [{
58  index: 0,
59  connection: {sourceLayerIndex:0, outputSlotIndex:0 },
60  }],
61  outputSlots: [{
62  index: 0,
63  tensorInfo: {
64  dimensions: )" + outputShape + R"(,
65  dataType: )" + dataType + R"(
66  }
67  }]
68  },
69  descriptor: {
70  padList: )" + padList + R"(,
71  paddingMode: )" + paddingMode + R"(,
72  }
73  }
74  },
75  {
76  layer_type: "OutputLayer",
77  layer: {
78  base:{
79  layerBindingId: 2,
80  base: {
81  index: 2,
82  layerName: "OutputLayer",
83  layerType: "Output",
84  inputSlots: [{
85  index: 0,
86  connection: {sourceLayerIndex:1, outputSlotIndex:0 },
87  }],
88  outputSlots: [{
89  index: 0,
90  tensorInfo: {
91  dimensions: )" + outputShape + R"(,
92  dataType: )" + dataType + R"(
93  },
94  }],
95  }
96  }
97  },
98  }
99  ]
100  }
101  )";
102  SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
103  }
104 };
105 
106 struct SimplePadFixture : PadFixture
107 {
108  SimplePadFixture() : PadFixture("[ 2, 2, 2 ]",
109  "[ 0, 1, 2, 1, 2, 2 ]",
110  "[ 3, 5, 6 ]",
111  "QuantisedAsymm8",
112  "Constant") {}
113 };
114 
115 TEST_CASE_FIXTURE(SimplePadFixture, "SimplePadQuantisedAsymm8")
116 {
117  RunTest<3, armnn::DataType::QAsymmU8>(0,
118  {
119  0, 4, 2, 5, 6, 1, 5, 2
120  },
121  {
122  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123  4, 0, 0, 0, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0,
124  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,
125  1, 0, 0, 0, 0, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0,
126  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
128  });
129 }
130 
131 struct SimplePadSymmetricFixture : PadFixture
132 {
133  SimplePadSymmetricFixture() : PadFixture("[ 2, 2, 2 ]",
134  "[ 1, 1, 1, 1, 1, 1 ]",
135  "[ 4, 4, 4 ]",
136  "QuantisedAsymm8",
137  "Symmetric") {}
138 };
139 
140 TEST_CASE_FIXTURE(SimplePadSymmetricFixture, "SimplePadSymmetricQuantisedAsymm8")
141 {
142  RunTest<3, armnn::DataType::QAsymmU8>(0,
143  {
144  1, 2,
145  3, 4,
146 
147  5, 6,
148  7, 8
149  },
150  {
151  1, 1, 2, 2,
152  1, 1, 2, 2,
153  3, 3, 4, 4,
154  3, 3, 4, 4,
155 
156  1, 1, 2, 2,
157  1, 1, 2, 2,
158  3, 3, 4, 4,
159  3, 3, 4, 4,
160 
161  5, 5, 6, 6,
162  5, 5, 6, 6,
163  7, 7, 8, 8,
164  7, 7, 8, 8,
165 
166  5, 5, 6, 6,
167  5, 5, 6, 6,
168  7, 7, 8, 8,
169  7, 7, 8, 8
170  });
171 }
172 
173 struct SimplePadReflectFixture : PadFixture
174 {
175  SimplePadReflectFixture() : PadFixture("[ 2, 2, 2 ]",
176  "[ 1, 1, 1, 1, 1, 1 ]",
177  "[ 4, 4, 4 ]",
178  "QuantisedAsymm8",
179  "Reflect") {}
180 };
181 
182 TEST_CASE_FIXTURE(SimplePadReflectFixture, "SimplePadReflectQuantisedAsymm8")
183 {
184  RunTest<3, armnn::DataType::QAsymmU8>(0,
185  {
186  1, 2,
187  3, 4,
188 
189  5, 6,
190  7, 8
191  },
192  {
193  8, 7, 8, 7,
194  6, 5, 6, 5,
195  8, 7, 8, 7,
196  6, 5, 6, 5,
197 
198  4, 3, 4, 3,
199  2, 1, 2, 1,
200  4, 3, 4, 3,
201  2, 1, 2, 1,
202 
203  8, 7, 8, 7,
204  6, 5, 6, 5,
205  8, 7, 8, 7,
206  6, 5, 6, 5,
207 
208  4, 3, 4, 3,
209  2, 1, 2, 1,
210  4, 3, 4, 3,
211  2, 1, 2, 1
212  });
213 }
214 
215 }
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")