blob: 7380d884fdc125718714b1db632d1db855a90b95 [file] [log] [blame]
telsoa01c577f2c2018-08-31 09:22:23 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa01c577f2c2018-08-31 09:22:23 +01004//
5
6#include <boost/test/unit_test.hpp>
7#include "ParserFlatbuffersFixture.hpp"
8#include "../TfLiteParser.hpp"
9
10#include <string>
11#include <iostream>
12
13BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
14
15struct DepthwiseConvolution2dFixture : public ParserFlatbuffersFixture
16{
17 explicit DepthwiseConvolution2dFixture(const std::string& inputShape,
18 const std::string& outputShape,
19 const std::string& filterShape,
20 const std::string& filterData,
21 const std::string& strides,
22 const std::string& paddingType,
23 const std::string biasShape = "",
24 const std::string biasData = "")
25 {
26 std::string inputTensors = "[ 0, 2 ]";
27 std::string biasTensor = "";
28 std::string biasBuffer = "";
29 if (biasShape.size() > 0 && biasData.size() > 0)
30 {
31 inputTensors = "[ 0, 2, 3 ]";
32 biasTensor = R"(
33 {
34 "shape": )" + biasShape + R"( ,
35 "type": "INT32",
36 "buffer": 3,
37 "name": "biasTensor",
38 "quantization": {
39 "min": [ 0.0 ],
40 "max": [ 255.0 ],
41 "scale": [ 1.0 ],
42 "zero_point": [ 0 ],
43 }
44 } )";
45 biasBuffer = R"(
46 { "data": )" + biasData + R"(, }, )";
47 }
48 m_JsonString = R"(
49 {
50 "version": 3,
51 "operator_codes": [ { "builtin_code": "DEPTHWISE_CONV_2D" } ],
52 "subgraphs": [ {
53 "tensors": [
54 {
55 "shape": )" + inputShape + R"(,
56 "type": "UINT8",
57 "buffer": 0,
58 "name": "inputTensor",
59 "quantization": {
60 "min": [ 0.0 ],
61 "max": [ 255.0 ],
62 "scale": [ 1.0 ],
63 "zero_point": [ 0 ],
64 }
65 },
66 {
67 "shape": )" + outputShape + R"(,
68 "type": "UINT8",
69 "buffer": 1,
70 "name": "outputTensor",
71 "quantization": {
72 "min": [ 0.0 ],
73 "max": [ 511.0 ],
74 "scale": [ 2.0 ],
75 "zero_point": [ 0 ],
76 }
77 },
78 {
79 "shape": )" + filterShape + R"(,
80 "type": "UINT8",
81 "buffer": 2,
82 "name": "filterTensor",
83 "quantization": {
84 "min": [ 0.0 ],
85 "max": [ 255.0 ],
86 "scale": [ 1.0 ],
87 "zero_point": [ 0 ],
88 }
89 }, )" + biasTensor + R"(
90 ],
91 "inputs": [ 0 ],
92 "outputs": [ 1 ],
93 "operators": [
94 {
95 "opcode_index": 0,
96 "inputs": )" + inputTensors + R"(,
97 "outputs": [ 1 ],
98 "builtin_options_type": "DepthwiseConv2DOptions",
99 "builtin_options": {
100 "padding": ")" + paddingType + R"(",
101 "stride_w": )" + strides+ R"(,
102 "stride_h": )" + strides+ R"(,
103 "depth_multiplier": 1,
104 "fused_activation_function": "NONE"
105 },
106 "custom_options_format": "FLEXBUFFERS"
107 }
108 ],
109 } ],
110 "buffers" : [
111 { },
112 { },
113 { "data": )" + filterData + R"(, }, )"
114 + biasBuffer + R"(
115 ]
116 }
117 )";
118 SetupSingleInputSingleOutput("inputTensor", "outputTensor");
119 }
120};
121
122struct DepthwiseConvolution2dSameFixture : DepthwiseConvolution2dFixture
123{
124 DepthwiseConvolution2dSameFixture()
125 : DepthwiseConvolution2dFixture("[ 1, 3, 3, 1 ]", // inputShape
126 "[ 1, 3, 3, 1 ]", // outputShape
127 "[ 1, 3, 3, 1 ]", // filterShape
128 "[ 9,8,7, 6,5,4, 3,2,1 ]", // filterData
129 "1", // stride w and h
130 "SAME") // padding type
131 {}
132};
133
134BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DSame, DepthwiseConvolution2dSameFixture)
135{
Derek Lambertif90c56d2020-01-10 17:14:08 +0000136 RunTest<4, armnn::DataType::QAsymmU8>(
telsoa01c577f2c2018-08-31 09:22:23 +0100137 0,
138 { 0, 1, 2,
139 3, 4, 5,
140 6, 7, 8 },
141 // the expected values were generated using the example python implementation at
142 // https://eli.thegreenplace.net/2018/depthwise-separable-convolutions-for-machine-learning/
143 // divide the expected values by the output scale, as it is not 1.0
144 { 14/2, 35/2, 38/2,
145 57/2, 120/2, 111/2,
146 110/2, 197/2, 158/2 });
147}
148
149struct DepthwiseConvolution2dValidFixture : DepthwiseConvolution2dFixture
150{
151 DepthwiseConvolution2dValidFixture ()
152 : DepthwiseConvolution2dFixture("[ 1, 3, 3, 1 ]", // inputShape
153 "[ 1, 1, 1, 1 ]", // outputShape
154 "[ 1, 3, 3, 1 ]", // filterShape
155 "[ 9,8,7, 6,5,4, 3,2,1 ]", // filterData
156 "1", // stride w and h
157 "VALID") // padding type
158 {}
159};
160
161BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DValid, DepthwiseConvolution2dValidFixture)
162{
Derek Lambertif90c56d2020-01-10 17:14:08 +0000163 RunTest<4, armnn::DataType::QAsymmU8>(
telsoa01c577f2c2018-08-31 09:22:23 +0100164 0,
165 { 0, 1, 2,
166 3, 4, 5,
167 6, 7, 8 },
168 // divide the expected values by the output scale, as it is not 1.0
169 { 120/2 });
170}
171
172struct DepthwiseConvolution2dSameBiasFixture : DepthwiseConvolution2dFixture
173{
174 DepthwiseConvolution2dSameBiasFixture()
175 : DepthwiseConvolution2dFixture("[ 1, 3, 3, 1 ]", // inputShape
176 "[ 1, 3, 3, 1 ]", // outputShape
177 "[ 1, 3, 3, 1 ]", // filterShape
178 "[ 9,8,7, 6,5,4, 3,2,1 ]", // filterData
179 "1", // stride w and h
180 "SAME", // padding type
181 "[ 1 ]", // biasShape
182 "[ 10, 0, 0, 0 ]") // biasData
183 {}
184};
185
186BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DSameBias, DepthwiseConvolution2dSameBiasFixture)
187{
Derek Lambertif90c56d2020-01-10 17:14:08 +0000188 RunTest<4, armnn::DataType::QAsymmU8>(
telsoa01c577f2c2018-08-31 09:22:23 +0100189 0,
190 { 0, 1, 2,
191 3, 4, 5,
192 6, 7, 8 },
193 // divide the expected values by the output scale, as it is not 1.0
194 { ( 14+10)/2, ( 35+10)/2, ( 38+10)/2,
195 ( 57+10)/2, (120+10)/2, (111+10)/2,
196 (110+10)/2, (197+10)/2, (158+10)/2 });
197}
198
Sadik Armagand109a4d2020-07-28 10:42:13 +0100199struct DynamicDepthwiseConvolution2dSameBiasFixture : DepthwiseConvolution2dFixture
200{
201 DynamicDepthwiseConvolution2dSameBiasFixture()
202 : DepthwiseConvolution2dFixture("[ 1, 3, 3, 1 ]", // inputShape
203 "[ ]", // outputShape
204 "[ 1, 3, 3, 1 ]", // filterShape
205 "[ 9,8,7, 6,5,4, 3,2,1 ]", // filterData
206 "1", // stride w and h
207 "SAME", // padding type
208 "[ 1 ]", // biasShape
209 "[ 10, 0, 0, 0 ]") // biasData
210 {}
211};
212
213BOOST_FIXTURE_TEST_CASE(ParseDynamicDepthwiseConv2DSameBias, DynamicDepthwiseConvolution2dSameBiasFixture)
214{
215 RunTest<4, armnn::DataType::QAsymmU8, armnn::DataType::QAsymmU8>(0,
216 { { "inputTensor", { 0, 1, 2,
217 3, 4, 5,
218 6, 7, 8 } } },
219 { { "outputTensor", { ( 14+10)/2, ( 35+10)/2, ( 38+10)/2,
220 ( 57+10)/2, (120+10)/2, (111+10)/2,
221 (110+10)/2, (197+10)/2, (158+10)/2 } } },
222 true);
223}
224
Jan Eilersf6491492021-04-02 13:06:15 +0100225struct DepthwiseConvolution2dFixture2 : public ParserFlatbuffersFixture
226{
227 explicit DepthwiseConvolution2dFixture2(const std::string& inputShape,
228 const std::string& outputShape,
229 const std::string& filterShape,
230 const std::string& filterData,
231 const std::string& strides,
232 const std::string& paddingType,
233 const std::string biasShape = "",
234 const std::string biasData = "",
235 const std::string filter_quant_min = "[ 0.0 ]",
236 const std::string filter_quant_max = "[ 255.0 ]",
237 const std::string filter_quant_scale = "[ 1.0 ]",
238 const std::string filter_quant_zero_point = "[ 0 ]",
239 const std::string filter_quant_axis = ""
240 )
241 {
242 std::string inputTensors = "[ 0, 2 ]";
243 std::string biasTensor = "";
244 std::string biasBuffer = "";
245 if (biasShape.size() > 0 && biasData.size() > 0)
246 {
247 inputTensors = "[ 0, 2, 3 ]";
248 biasTensor = R"(
249 {
250 "shape": )" + biasShape + R"( ,
251 "type": "INT32",
252 "buffer": 3,
253 "name": "biasTensor",
254 "quantization": {
255 "min": [ 0.0 ],
256 "max": [ 255.0 ],
257 "scale": [ 1.0 ],
258 "zero_point": [ 0 ],
259 }
260 } )";
261 biasBuffer = R"(
262 { "data": )" + biasData + R"(, }, )";
263 }
264
265 std::string filter_qantization =
266 R"(
267 "min": )" + filter_quant_min + R"(,
268 "max": )" + filter_quant_max + R"(,
269 "scale": )" + filter_quant_scale + R"(,
270 "zero_point": )" + filter_quant_zero_point;
271 // A given quantization axis indicates if per channel quantization is used for filters
272 if (filter_quant_axis.size() > 0)
273 {
274 filter_qantization +=
275 R"(,
276 "quantized_dimension": )" + filter_quant_axis;
277 }
278 m_JsonString = R"(
279 {
280 "version": 3,
281 "operator_codes": [ { "builtin_code": "DEPTHWISE_CONV_2D" } ],
282 "subgraphs": [ {
283 "tensors": [
284 {
285 "shape": )" + inputShape + R"(,
286 "type": "INT8",
287 "buffer": 0,
288 "name": "inputTensor",
289 "quantization": {
290 "min": [ 0.0 ],
291 "max": [ 255.0 ],
292 "scale": [ 1.0 ],
293 "zero_point": [ 0 ],
294 }
295 },
296 {
297 "shape": )" + outputShape + R"(,
298 "type": "INT8",
299 "buffer": 1,
300 "name": "outputTensor",
301 "quantization": {
302 "min": [ 0.0 ],
303 "max": [ 511.0 ],
304 "scale": [ 1.0 ],
305 "zero_point": [ 0 ],
306 }
307 },
308 {
309 "shape": )" + filterShape + R"(,
310 "type": "INT8",
311 "buffer": 2,
312 "name": "filterTensor",
313 "quantization": {)" + filter_qantization + R"(
314 }
315 }, )" + biasTensor + R"(
316 ],
317 "inputs": [ 0 ],
318 "outputs": [ 1 ],
319 "operators": [
320 {
321 "opcode_index": 0,
322 "inputs": )" + inputTensors + R"(,
323 "outputs": [ 1 ],
324 "builtin_options_type": "DepthwiseConv2DOptions",
325 "builtin_options": {
326 "padding": ")" + paddingType + R"(",
327 "stride_w": )" + strides+ R"(,
328 "stride_h": )" + strides+ R"(,
329 "depth_multiplier": 1,
330 "fused_activation_function": "NONE"
331 },
332 "custom_options_format": "FLEXBUFFERS"
333 }
334 ],
335 } ],
336 "buffers" : [
337 { },
338 { },
339 { "data": )" + filterData + R"(, }, )"
340 + biasBuffer + R"(
341 ]
342 }
343 )";
344 SetupSingleInputSingleOutput("inputTensor", "outputTensor");
345 }
346};
347
348
349// No quantization meaning scale=1.0 and offset=0.0 and tensor quantization
350struct DepthwiseConvolution2dNoQuantFixture : DepthwiseConvolution2dFixture2
351{
352 DepthwiseConvolution2dNoQuantFixture()
353 : DepthwiseConvolution2dFixture2("[ 1, 3, 3, 3 ]", // inputShape
354 "[ 1, 3, 3, 3 ]", // outputShape
355 "[ 1, 3, 3, 3 ]", // filterShape
356 "[ 9,8,7, 6,5,4, 3,2,1, "
357 "9,8,7, 6,5,4, 3,2,1, "
358 "9,8,7, 6,5,4, 3,2,1 ]", // filterData
359 "1", // stride w and h
360 "SAME", // padding type
361 "", // bias shape
362 "" // bias data
363 )
364 {}
365};
366
367// No quantization meaning scale=1.0 and offset=0.0 and tensor quantization
368BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DNoQuant, DepthwiseConvolution2dNoQuantFixture)
369{
370 RunTest<4, armnn::DataType::QAsymmS8>(
371 0,
372 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
373 { 18, 14, 10, 36, 30, 24, 30, 26, 22, 27, 21, 15, 54, 45,
374 36, 45, 39, 33, 18, 14, 10, 36, 30, 24, 30, 26, 22});
375}
376
377// Uses per channel quantization on weights but with scales = 1.0 and offsets = 0.0
378struct DepthwiseConvolution2dNoChannelQuantFixture : DepthwiseConvolution2dFixture2
379{
380 DepthwiseConvolution2dNoChannelQuantFixture()
381 : DepthwiseConvolution2dFixture2("[ 1, 3, 3, 3 ]", // inputShape
382 "[ 1, 3, 3, 3 ]", // outputShape
383 "[ 1, 3, 3, 3 ]", // filterShape
384 "[ 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1 ]", // filterData
385 "1", // stride w and h
386 "SAME", // padding type
387 "", // bias shape
388 "", // bias data
389 "[ 0.0 ]", // filter quantization min values
390 "[ 255.0 ]", // filter quantization max values
391 "[ 1.0, 1.0, 1.0]", // filter quantization scales
392 "[ 0, 0, 0]", // filter quantization zero-points
393 "3" // filter quantized axis
394 // (in case of per channel quantization)
395 )
396 {}
397};
398
399// Uses per channel quantization on weights but with scales = 1.0 and offsets = 0.0
400BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DFilterNoChannelQuant, DepthwiseConvolution2dNoChannelQuantFixture)
401{
402 RunTest<4, armnn::DataType::QAsymmS8>(
403 0,
404 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
405 { 18, 14, 10, 36, 30, 24, 30, 26, 22, 27, 21, 15, 54, 45,
406 36, 45, 39, 33, 18, 14, 10, 36, 30, 24, 30, 26, 22});
407}
408
409// Uses per channel quantization on weights but all scales are set to the same value
410struct DepthwiseConvolution2dWeightsPerChannelQuantFixture : DepthwiseConvolution2dFixture2
411{
412 DepthwiseConvolution2dWeightsPerChannelQuantFixture()
413 : DepthwiseConvolution2dFixture2("[ 1, 3, 3, 3 ]", // inputShape
414 "[ 1, 3, 3, 3 ]", // outputShape
415 "[ 1, 3, 3, 3 ]", // filterShape
416 // filterData is [ 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1 ]
417 // quantized per channel with q_dim=3
418 "[36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, "
419 "20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12, 8, 4]",
420 "1", // stride w and h
421 "SAME", // padding type
422 "", // bias shape
423 "", // bias data
424 "[ 0.0 ]", // filter quantization min values
425 "[ 255.0 ]", // filter quantization max values
426 "[ 0.25, 0.25, 0.25]", // filter quantization scales
427 "[ 0, 0, 0]", // filter quantization zero-points
428 "3" // filter quantized axis
429 // (in case of per channel quantization)
430 )
431 {}
432};
433
434// Weights are per channel quantized but all scales are set to the same value
435BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DFilterWeightsPerChannelQuant,
436 DepthwiseConvolution2dWeightsPerChannelQuantFixture)
437{
438 RunTest<4, armnn::DataType::QAsymmS8>(
439 0,
440 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
441 { 18, 14, 10, 36, 30, 24, 30, 26, 22, 27, 21, 15, 54, 45,
442 36, 45, 39, 33, 18, 14, 10, 36, 30, 24, 30, 26, 22});
443}
444
445// Uses per channel quantization on weights all scales are different in this test
446struct DepthwiseConvolution2dWeightsPerChannelQuant1Fixture : DepthwiseConvolution2dFixture2
447{
448 DepthwiseConvolution2dWeightsPerChannelQuant1Fixture()
449 : DepthwiseConvolution2dFixture2("[ 1, 3, 3, 3 ]", // inputShape
450 "[ 1, 3, 3, 3 ]", // outputShape
451 "[ 1, 3, 3, 3 ]", // filterShape
452 // filterData is [ 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1, 9,8,7, 6,5,4, 3,2,1 ]
453 // quantized per channel with q_dim=3
454 "[36, 40, 70, 24, 25, 40, 12, 10, 10, 36, 40, 70, 24, "
455 "25, 40, 12, 10, 10, 36, 40, 70, 24, 25, 40, 12, 10, 10]",
456 "1", // stride w and h
457 "SAME", // padding type
458 "", // bias shape
459 "", // bias data
460 "[ 0.0 ]", // filter quantization min values
461 "[ 255.0 ]", // filter quantization max values
462 "[ 0.25, 0.2, 0.1]", // filter quantization scales
463 "[ 0, 0, 0]", // filter quantization zero-points
464 "3" // filter quantized axis
465 // (in case of per channel quantization)
466 )
467 {}
468};
469
470// Uses per channel quantization on weights all scales are different in this test
471BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DFilterWeightsPerChannelQuant1,
472 DepthwiseConvolution2dWeightsPerChannelQuant1Fixture)
473{
474 RunTest<4, armnn::DataType::QAsymmS8>(
475 0,
476 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
477 { 18, 14, 10, 36, 30, 24, 30, 26, 22, 27, 21, 15, 54, 45,
478 36, 45, 39, 33, 18, 14, 10, 36, 30, 24, 30, 26, 22});
479}
480
481
482// Uses per channel quantization on weights all scales are different in this test
483// Uses different shape for weights and input compared to the other tests above
484struct DepthwiseConvolution2dWeightsPerChannelQuant2Fixture : DepthwiseConvolution2dFixture2
485{
486 DepthwiseConvolution2dWeightsPerChannelQuant2Fixture()
487 : DepthwiseConvolution2dFixture2("[ 1, 4, 4, 4 ]", // inputShape
488 "[ 1, 4, 4, 4 ]", // outputShape
489 "[ 1, 2, 2, 4 ]", // filterShape
490 // filterData is [ 9,8,7,6, 5,4,3,2, 1,9,8,7, 6,5,4,3 ]
491 // quantized per channel with q_dim=3
492 "[36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10]",
493 "1", // stride w and h
494 "SAME", // padding type
495 "", // bias shape
496 "", // bias data
497 "[ 0.0 ]", // filter quantization min values
498 "[ 255.0 ]", // filter quantization max values
499 "[ 0.25, 0.2, 0.1, 0.3]", // filter quantization scales
500 "[ 0, 0, 0, 0]", // filter quantization zero-points
501 "3" // filter quantized axis
502 // (in case of per channel quantization)
503 )
504 {}
505};
506
507// Uses per channel quantization on weights all scales are different in this test
508// Uses different shape for weights and input compared to the other tests above
509BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DFilterWeightsPerChannelQuant2,
510 DepthwiseConvolution2dWeightsPerChannelQuant2Fixture)
511{
512 RunTest<4, armnn::DataType::QAsymmS8>(
513 0,
514 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
515 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
516 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
517 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1},
518 { 21, 26, 22, 18, 21, 26, 22, 18, 21, 26, 22, 18, 10, 17, 15, 13,
519 21, 26, 22, 18, 21, 26, 22, 18, 21, 26, 22, 18, 10, 17, 15, 13,
520 21, 26, 22, 18, 21, 26, 22, 18, 21, 26, 22, 18, 10, 17, 15, 13,
521 14, 12, 10, 8, 14, 12, 10, 8, 14, 12, 10, 8, 9, 8, 7, 6});
522}
523
524// Test for depthwise_multiplier different to one (M > 1)
525struct DepthwiseConvolution2dWeightsPerChannelQuant4Fixture : DepthwiseConvolution2dFixture2
526{
527 DepthwiseConvolution2dWeightsPerChannelQuant4Fixture()
528 : DepthwiseConvolution2dFixture2("[ 1, 4, 4, 4 ]", // inputShape
529 "[ 1, 4, 4, 16 ]", // outputShape
530 "[ 1, 2, 2, 16 ]", // filterShape
531 // filter data is [ 9,8,7,6, 5,4,3,2, 1,9,8,7, 6,5,4,3,
532 // 9,8,7,6, 5,4,3,2, 1,9,8,7, 6,5,4,3,
533 // 9,8,7,6, 5,4,3,2, 1,9,8,7, 6,5,4,3,
534 // 9,8,7,6, 5,4,3,2, 1,9,8,7, 6,5,4,3 ]
535 // quantized per channel with q_dim=3
536 "[36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10, "
537 "36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10, "
538 "36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10, "
539 "36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10]",
540 "1", // stride w and h
541 "SAME", // padding type
542 "", // bias shape
543 "", // bias data
544 "[ 0.0 ]", // filter quantization min values
545 "[ 255.0 ]", // filter quantization max values
546 "[ 0.25, 0.2, 0.1, 0.3,"
547 "0.25, 0.2, 0.1, 0.3,"
548 "0.25, 0.2, 0.1, 0.3,"
549 "0.25, 0.2, 0.1, 0.3]", // filter quantization scales
550 "[ 0, 0, 0, 0]", // filter quantization zero-points
551 "3" // filter quantized axis
552 // (in case of per channel quantization)
553 )
554 {}
555};
556
557// Test for depthwise_multiplier different to one (M > 1)
558BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DFilterWeightsPerChannelQuant4,
559 DepthwiseConvolution2dWeightsPerChannelQuant4Fixture)
560{
561 RunTest<4, armnn::DataType::QAsymmS8>(
562 0,
563 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
564 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
565 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
566 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1},
567 { 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
568 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
569 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
570 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
571 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
572 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
573 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
574 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
575 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
576 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
577 36, 32, 28, 24, 20, 16, 12, 8, 4, 36, 32, 28, 24, 20, 16, 12,
578 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
579 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
580 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
581 18, 16, 14, 12, 10, 8, 6, 4, 2, 18, 16, 14, 12, 10, 8, 6,
582 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3});
583}
584
telsoa01c577f2c2018-08-31 09:22:23 +0100585BOOST_AUTO_TEST_SUITE_END()