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 });
BOOST_FIXTURE_TEST_CASE(ParseDepthwiseConv2DSame, DepthwiseConvolution2dSameFixture)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)