6 #include <boost/test/unit_test.hpp> 8 #include "../TfLiteParser.hpp" 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 =
"")
26 std::string inputTensors =
"[ 0, 2 ]";
27 std::string biasTensor =
"";
28 std::string biasBuffer =
"";
29 if (biasShape.size() > 0 && biasData.size() > 0)
31 inputTensors =
"[ 0, 2, 3 ]";
34 "shape": )" + biasShape + R"( , 46 { "data": )" + biasData + R"(, }, )"; 51 "operator_codes": [ { "builtin_code": "DEPTHWISE_CONV_2D" } ], 55 "shape": )" + inputShape + R"(, 58 "name": "inputTensor", 67 "shape": )" + outputShape + R"(, 70 "name": "outputTensor", 79 "shape": )" + filterShape + R"(, 82 "name": "filterTensor", 89 }, )" + biasTensor + R"( 96 "inputs": )" + inputTensors + R"(, 98 "builtin_options_type": "DepthwiseConv2DOptions", 100 "padding": ")" + paddingType + R"(", 101 "stride_w": )" + strides+ R"(, 102 "stride_h": )" + strides+ R"(, 103 "depth_multiplier": 1, 104 "fused_activation_function": "NONE" 106 "custom_options_format": "FLEXBUFFERS" 113 { "data": )" + filterData + R"(, }, )" 122 struct DepthwiseConvolution2dSameFixture : DepthwiseConvolution2dFixture
124 DepthwiseConvolution2dSameFixture()
125 : DepthwiseConvolution2dFixture(
"[ 1, 3, 3, 1 ]",
128 "[ 9,8,7, 6,5,4, 3,2,1 ]",
136 RunTest<4, armnn::DataType::QAsymmU8>(
146 110/2, 197/2, 158/2 });
149 struct DepthwiseConvolution2dValidFixture : DepthwiseConvolution2dFixture
151 DepthwiseConvolution2dValidFixture ()
152 : DepthwiseConvolution2dFixture(
"[ 1, 3, 3, 1 ]",
155 "[ 9,8,7, 6,5,4, 3,2,1 ]",
163 RunTest<4, armnn::DataType::QAsymmU8>(
172 struct DepthwiseConvolution2dSameBiasFixture : DepthwiseConvolution2dFixture
174 DepthwiseConvolution2dSameBiasFixture()
175 : DepthwiseConvolution2dFixture(
"[ 1, 3, 3, 1 ]",
178 "[ 9,8,7, 6,5,4, 3,2,1 ]",
188 RunTest<4, armnn::DataType::QAsymmU8>(
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 });
199 struct DynamicDepthwiseConvolution2dSameBiasFixture : DepthwiseConvolution2dFixture
201 DynamicDepthwiseConvolution2dSameBiasFixture()
202 : DepthwiseConvolution2dFixture(
"[ 1, 3, 3, 1 ]",
205 "[ 9,8,7, 6,5,4, 3,2,1 ]",
215 RunTest<4, armnn::DataType::QAsymmU8, armnn::DataType::QAsymmU8>(0,
216 { {
"inputTensor", { 0, 1, 2,
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 } } },
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 const std::string output_scale =
"[ 1.0 ]")
242 std::string inputTensors =
"[ 0, 2 ]";
243 std::string biasTensor =
"";
244 std::string biasBuffer =
"";
245 if (biasShape.size() > 0 && biasData.size() > 0)
247 inputTensors =
"[ 0, 2, 3 ]";
250 "shape": )" + biasShape + R"( , 253 "name": "biasTensor", 262 { "data": )" + biasData + R"(, }, )"; 265 std::string filter_qantization = 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; 272 if (filter_quant_axis.size() > 0)
274 filter_qantization +=
276 "quantized_dimension": )" + filter_quant_axis; 281 "operator_codes": [ { "builtin_code": "DEPTHWISE_CONV_2D" } ], 285 "shape": )" + inputShape + R"(, 288 "name": "inputTensor", 297 "shape": )" + outputShape + R"(, 300 "name": "outputTensor", 304 "scale": )" + output_scale + R"(, 309 "shape": )" + filterShape + R"(, 312 "name": "filterTensor", 313 "quantization": {)" + filter_qantization + R"( 315 }, )" + biasTensor + R"( 322 "inputs": )" + inputTensors + R"(, 324 "builtin_options_type": "DepthwiseConv2DOptions", 326 "padding": ")" + paddingType + R"(", 327 "stride_w": )" + strides+ R"(, 328 "stride_h": )" + strides+ R"(, 329 "depth_multiplier": 1, 330 "fused_activation_function": "NONE" 332 "custom_options_format": "FLEXBUFFERS" 339 { "data": )" + filterData + R"(, }, )" 344 SetupSingleInputSingleOutput("inputTensor",
"outputTensor");
350 struct DepthwiseConvolution2dNoQuantFixture : DepthwiseConvolution2dFixture2
352 DepthwiseConvolution2dNoQuantFixture()
353 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 3 ]",
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 ]",
370 RunTest<4, armnn::DataType::QAsymmS8>(
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});
378 struct DepthwiseConvolution2dNoChannelQuantFixture : DepthwiseConvolution2dFixture2
380 DepthwiseConvolution2dNoChannelQuantFixture()
381 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 3 ]",
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 ]",
402 RunTest<4, armnn::DataType::QAsymmS8>(
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});
410 struct DepthwiseConvolution2dWeightsPerChannelQuantFixture : DepthwiseConvolution2dFixture2
412 DepthwiseConvolution2dWeightsPerChannelQuantFixture()
413 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 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]",
426 "[ 0.25, 0.25, 0.25]",
436 DepthwiseConvolution2dWeightsPerChannelQuantFixture)
438 RunTest<4, armnn::DataType::QAsymmS8>(
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});
446 struct DepthwiseConvolution2dWeightsPerChannelQuant1Fixture : DepthwiseConvolution2dFixture2
448 DepthwiseConvolution2dWeightsPerChannelQuant1Fixture()
449 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 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]",
472 DepthwiseConvolution2dWeightsPerChannelQuant1Fixture)
474 RunTest<4, armnn::DataType::QAsymmS8>(
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});
484 struct DepthwiseConvolution2dWeightsPerChannelQuant2Fixture : DepthwiseConvolution2dFixture2
486 DepthwiseConvolution2dWeightsPerChannelQuant2Fixture()
487 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
492 "[36, 40, 70, 20, 20, 20, 30, 6, 4, 45, 80, 23, 24, 25, 40, 10]",
499 "[ 0.25, 0.2, 0.1, 0.3]",
510 DepthwiseConvolution2dWeightsPerChannelQuant2Fixture)
512 RunTest<4, armnn::DataType::QAsymmS8>(
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});
525 struct DepthwiseConvolution2dWeightsPerChannelQuant4Fixture : DepthwiseConvolution2dFixture2
527 DepthwiseConvolution2dWeightsPerChannelQuant4Fixture()
528 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
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]",
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]",
559 DepthwiseConvolution2dWeightsPerChannelQuant4Fixture)
561 RunTest<4, armnn::DataType::QAsymmS8>(
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});
586 struct DepthwiseConvolution2dWeightsPerChannelQuant6Fixture : DepthwiseConvolution2dFixture2
588 DepthwiseConvolution2dWeightsPerChannelQuant6Fixture()
589 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
597 "[12,20,10, 3, 4,15,30, 6, 4,20,30,12, 4,10,20,12," 598 " 8, 0,30, 3, 0,10,40, 9,16,15, 0, 3,12,20,40, 3," 599 " 12,15,20, 0, 0, 0,10, 9,12,10,40,12,12, 5,10, 9," 600 " 4, 0, 0, 6,12, 0,10, 3,16,10,20, 3, 8,15,20, 0]",
607 "[ 0.25, 0.2, 0.1, 0.333333333," 608 "0.25, 0.2, 0.1, 0.333333333," 609 "0.25, 0.2, 0.1, 0.333333333," 610 "0.25, 0.2, 0.1, 0.333333333]",
620 DepthwiseConvolution2dWeightsPerChannelQuant6Fixture)
622 RunTest<4, armnn::DataType::QAsymmS8>(
624 { 1,0,1,2,0,4,4,0,2,1,2,0,1,3,3,0,
625 1,2,2,3,3,4,1,1,2,4,1,3,4,2,0,2,
626 0,3,1,3,4,3,2,0,1,2,3,3,0,2,4,2,
627 1,2,1,4,3,4,1,3,1,0,2,3,1,3,2,0},
628 { 9, 7, 3, 7,12, 8,22,22,27,22,13,17,13,10, 9,17,
629 15, 9,12, 6,16,14,24,27,19,26,18,23, 9,10, 7, 3,
630 18,14, 9,11, 7, 9,21,25,17,19,10,15,13, 9, 7, 9,
631 15,16, 9, 1, 3, 9,11,12, 3,12, 9,12, 6, 2, 2, 6,
632 13, 4,10,12,11,14,28,28,17,17,14,15,15,13,13,22,
633 26,24,17, 7,10,20,33,31,23,17,17,16,16,23,20, 7,
634 17,11,16, 6,10,16,24,22,26,18,23,20,22,23,21,23,
635 12,16, 4, 4, 2, 6, 8,10,12, 8,16,16, 8, 6, 6,14,
636 14, 3,14,10,15,15,27,25,16,14, 9,11,21,19,16,24,
637 24,25,13, 7, 3,13,21,24,25,23,14,17,24,24,21,12,
638 7, 7, 3, 3,11,10,17,13,33,32,21,26,18,17,17,23,
639 3, 3, 2, 0, 2, 6, 9,13,10,20,20,24, 2, 4, 4, 8,
640 9, 4,10, 4, 2,14,22,16, 5, 7, 3, 5,13,20,20,19,
641 11,12, 6, 4, 4,12,12, 8, 9,10, 3, 6,12,18,18,15,
642 5, 4, 4, 2, 0, 6,12, 9,10,14, 6,10, 3, 6, 6,12,
643 3, 4, 1, 1, 3, 9, 9, 6, 2, 8, 6, 8, 0, 0, 0, 0});
647 struct DepthwiseConvolution2dWeightsPerChannelQuant1_1Fixture : DepthwiseConvolution2dFixture2
649 DepthwiseConvolution2dWeightsPerChannelQuant1_1Fixture()
650 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 3 ]",
657 "[ 4,20, 0, 8,20,30, 4, 0,10,12," 658 " 0,40, 0, 5,30,16,10,40,12, 0," 659 "30,16,20, 0,12,20,20]",
676 DepthwiseConvolution2dWeightsPerChannelQuant1_1Fixture)
678 RunTest<4, armnn::DataType::QAsymmS8>(
680 { 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},
681 { 11,11, 9,17,11,16,10, 5,10,
682 14,15,13,21,19,20,13,13,13,
683 7, 7,11,11,11,15, 6, 9,10});
687 struct DepthwiseConvolution2dWeightsPerChannelQuant1_2Fixture : DepthwiseConvolution2dFixture2
689 DepthwiseConvolution2dWeightsPerChannelQuant1_2Fixture()
690 : DepthwiseConvolution2dFixture2(
"[ 1, 3, 3, 3 ]",
697 "[ 4,20, 0, 8,20,30, 4, 0,10,12," 698 " 0,40, 0, 5,30,16,10,40,12, 0," 699 "30,16,20, 0,12,20,20]",
716 DepthwiseConvolution2dWeightsPerChannelQuant1_2Fixture)
718 RunTest<4, armnn::DataType::QAsymmS8>(
723 { 0,30,16,15,30,32, 8, 9,24,
724 20,33,28,34,48,50,18,38,35,
725 8, 8,36,20,28,33,10,28,25});
729 struct DepthwiseConvolution2dWeightsPerChannelQuant4_1Fixture : DepthwiseConvolution2dFixture2
731 DepthwiseConvolution2dWeightsPerChannelQuant4_1Fixture()
732 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
740 "[12,20,10, 3, 4,15,30, 6, 4,20,30,13, 4,10,20,13," 741 " 8, 0,30, 3, 0,10,40,10,16,15, 0, 3,12,20,40, 3," 742 " 12,15,20, 0, 0, 0,10,10,12,10,40,13,12, 5,10,10," 743 " 4, 0, 0, 6,12, 0,10, 3,16,10,20, 3, 8,15,20, 0]",
750 "[ 0.25, 0.2, 0.1, 0.3," 751 "0.25, 0.2, 0.1, 0.3," 752 "0.25, 0.2, 0.1, 0.3," 753 "0.25, 0.2, 0.1, 0.3]",
763 DepthwiseConvolution2dWeightsPerChannelQuant4_1Fixture)
765 RunTest<4, armnn::DataType::QAsymmS8>(
767 { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
768 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
769 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1,
770 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1},
771 { 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
772 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
773 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
774 6, 7, 3, 1, 1, 3, 4, 5, 4, 6, 7, 8, 4, 3, 3, 7,
775 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
776 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
777 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
778 6, 7, 3, 1, 1, 3, 4, 5, 4, 6, 7, 8, 4, 3, 3, 7,
779 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
780 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
781 9, 7, 6, 4, 4, 5, 9, 9,12,11, 9,10, 9,10, 9, 8,
782 6, 7, 3, 1, 1, 3, 4, 5, 4, 6, 7, 8, 4, 3, 3, 7,
783 5, 4, 4, 2, 1, 5, 7, 5, 5, 7, 3, 5, 4, 6, 6, 5,
784 5, 4, 4, 2, 1, 5, 7, 5, 5, 7, 3, 5, 4, 6, 6, 5,
785 5, 4, 4, 2, 1, 5, 7, 5, 5, 7, 3, 5, 4, 6, 6, 5,
786 3, 4, 1, 1, 1, 3, 3, 2, 1, 4, 3, 4, 1, 2, 2, 4});
791 struct DepthwiseConvolution2dWeightsPerChannelQuant4_2Fixture : DepthwiseConvolution2dFixture2
793 DepthwiseConvolution2dWeightsPerChannelQuant4_2Fixture()
794 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
802 "[12,20,10, 3, 4,15,30, 6, 4,20,30,13, 4,10,20,13," 803 " 8, 0,30, 3, 0,10,40,10,16,15, 0, 3,12,20,40, 3," 804 " 12,15,20, 0, 0, 0,10,10,12,10,40,13,12, 5,10,10," 805 " 4, 0, 0, 6,12, 0,10, 3,16,10,20, 3, 8,15,20, 0]",
812 "[ 0.25, 0.2, 0.1, 0.3," 813 "0.25, 0.2, 0.1, 0.3," 814 "0.25, 0.2, 0.1, 0.3," 815 "0.25, 0.2, 0.1, 0.3]",
825 DepthwiseConvolution2dWeightsPerChannelQuant4_2Fixture)
827 RunTest<4, armnn::DataType::QAsymmS8>(
829 { 3,3,3,4, 4,4,0,0, 0,3,4,3, 0,2,2,3,
830 3,0,3,0, 0,3,2,1, 4,1,2,2, 0,0,0,4,
831 3,2,2,2, 2,1,0,4, 4,3,2,4, 3,2,0,0,
832 4,1,4,4, 1,0,4,3, 3,2,0,3, 1,1,0,2},
833 { 26,21,21, 7,12,17,28,21,20,22,25,26, 6,11,10,16,
834 16,16, 4,12, 7,18,28,27,30,20,12,14,16,19,17, 6,
835 12,12, 8, 0, 3,13,18,15,18,26,20,26,26,32,28,21,
836 0, 0, 0, 0, 2, 6, 6, 4, 2, 8, 6, 8,15,10,10,24,
837 20,21, 9, 7, 3, 6,15,16,17,22,17,22,17,18,14, 7,
838 18, 6,16,12,12,11,17,15,18,18,10,12,27,26,22,18,
839 27,28,12,10, 7, 3, 8,13, 8,12,14,16,26,24,24,24,
840 9, 9, 6, 0, 0, 0, 2, 6, 0, 0, 0, 0, 4, 8, 8,16,
841 26,24,17, 7, 2, 8,11,10,30,24,30,28,32,33,30,24,
842 20,11,16,12, 7, 9,17,13,20,14,16,18,31,36,33,29,
843 28,25,19, 9, 6,13,20,19, 2, 8, 6, 8,17,17,15,25,
844 12,15, 5, 3, 2, 6, 7, 7, 0, 0, 0, 0, 6, 2, 2, 6,
845 14,16, 7, 5, 1, 3, 3, 2,20,28,12,20,13,20,20,19,
846 9, 4,10, 4, 0, 4, 8, 6, 4,16,12,16,12,18,18,15,
847 11,12, 6, 4, 2, 8,10, 7, 0, 0, 0, 0, 9,14,14,14,
848 3, 4, 1, 1, 1, 3, 3, 2, 0, 0, 0, 0, 2, 4, 4, 8});
852 struct DepthwiseConvolution2dWeightsPerChannelQuant4_5Fixture : DepthwiseConvolution2dFixture2
854 DepthwiseConvolution2dWeightsPerChannelQuant4_5Fixture()
855 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
870 "[ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16," 871 " 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32," 872 " 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48," 873 "49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64]",
880 "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16]",
891 DepthwiseConvolution2dWeightsPerChannelQuant4_5Fixture)
893 RunTest<4, armnn::DataType::QAsymmS8>(
895 { 1,1,1,2,2,2,1,2,1,2,2,1,2,2,1,1,1,1,1,1,1,2,2,2,
896 1,2,2,2,1,1,1,2,1,1,1,1,2,1,2,1,2,1,1,2,1,2,1,1,
897 1,2,2,1,2,2,1,1,2,1,2,1,1,2,1,2},
898 { 1, 2, 3, 5, 9,11,14,16,17,19,21,24,32,36,39,43,
899 1, 2, 3, 4,11,14,17,20,22,26,29,33,34,38,42,46,
900 1, 2, 3, 5, 8,11,13,16,16,18,21,24,33,36,39,43,
901 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6,13,14,16,17,
902 1, 3, 4, 6, 6, 8,10,12,19,22,24,27,23,25,28,30,
903 1, 3, 5, 8, 7, 8,10,12,18,21,24,27,32,36,39,43,
904 1, 2, 4, 5, 8,10,13,15,12,14,16,18,30,33,37,40,
905 0, 0, 1, 1, 3, 4, 5, 7, 4, 5, 5, 6, 9,10,11,12,
906 1, 3, 5, 7,10,12,15,17,17,20,23,25,19,21,23,25,
907 2, 4, 6, 8, 7, 9,11,13,17,20,23,25,23,25,28,30,
908 1, 2, 4, 6, 9,11,14,16,15,17,20,22,28,31,35,38,
909 0, 0, 1, 1, 4, 5, 6, 7, 4, 5, 5, 6,13,14,16,17,
910 0, 0, 1, 1, 2, 3, 4, 5, 3, 4, 5, 6, 5, 6, 6, 7,
911 0, 0, 1, 1, 1, 2, 2, 3, 5, 6, 7, 8, 5, 6, 6, 7,
912 0, 0, 0, 1, 2, 3, 3, 4, 3, 4, 5, 6, 9,10,11,12,
913 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 3, 3, 4, 5});
917 struct DepthwiseConvolution2dWeightsPerChannelQuant4_3_1Fixture : DepthwiseConvolution2dFixture2
919 DepthwiseConvolution2dWeightsPerChannelQuant4_3_1Fixture()
920 : DepthwiseConvolution2dFixture2(
"[ 1, 4, 4, 4 ]",
928 "[12,20,10, 3, 2,24, 9,10, 5,16,30,12, 3,10, 4,32," 929 " 8, 0,30, 3, 0,16,12,15,20,12, 0, 3, 9,20, 8, 8," 930 " 12,15,20, 0, 0, 0, 3,15,15, 8,40,12, 9, 5, 2,24," 931 " 4, 0, 0, 6, 6, 0, 3, 5,20, 8,20, 3, 6,15, 4, 0]",
938 "[0.25, 0.2, 0.1, 0.3333333333, " 939 "0.5, 0.125, 0.33333333, 0.2, " 940 "0.2, 0.25, 0.1, 0.333333333, " 941 "0.3333333333, 0.2, 0.5, 0.125]",
951 DepthwiseConvolution2dWeightsPerChannelQuant4_3_1Fixture)
953 RunTest<4, armnn::DataType::QAsymmS8>(
955 { 3,3,3,4, 4,4,0,0, 0,3,4,3, 0,2,2,3,
956 3,0,3,0, 0,3,2,1, 4,1,2,2, 0,0,0,4,
957 3,2,2,2, 2,1,0,4, 4,3,2,4, 3,2,0,0,
958 4,1,4,4, 1,0,4,3, 3,2,0,3, 1,1,0,2},
959 { 26,21,21, 7,12,17,28,21,20,22,25,26, 6,11,10,16,
960 16,16, 4,12, 7,18,28,27,30,20,12,14,16,19,17, 6,
961 12,12, 8, 0, 3,13,18,15,18,26,20,26,26,32,28,21,
962 0, 0, 0, 0, 2, 6, 6, 4, 2, 8, 6, 8,15,10,10,24,
963 20,21, 9, 7, 3, 6,15,16,17,22,17,22,17,18,14, 7,
964 18, 6,16,12,12,11,17,15,18,18,10,12,27,26,22,18,
965 27,28,12,10, 7, 3, 8,13, 8,12,14,16,26,24,24,24,
966 9, 9, 6, 0, 0, 0, 2, 6, 0, 0, 0, 0, 4, 8, 8,16,
967 26,24,17, 7, 2, 8,11,10,30,24,30,28,32,33,30,24,
968 20,11,16,12, 7, 9,17,13,20,14,16,18,31,36,33,29,
969 28,25,19, 9, 6,13,20,19, 2, 8, 6, 8,17,17,15,25,
970 12,15, 5, 3, 2, 6, 7, 7, 0, 0, 0, 0, 6, 2, 2, 6,
971 14,16, 7, 5, 1, 3, 3, 2,20,28,12,20,13,20,20,19,
972 9, 4,10, 4, 0, 4, 8, 6, 4,16,12,16,12,18,18,15,
973 11,12, 6, 4, 2, 8,10, 7, 0, 0, 0, 0, 9,14,14,14,
974 3, 4, 1, 1, 1, 3, 3, 2, 0, 0, 0, 0, 2, 4, 4, 8});
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DSame, DepthwiseConvolution2dSameFixture)