6 #include <boost/test/unit_test.hpp> 8 #include "../TfLiteParser.hpp" 17 explicit BatchToSpaceNDFixture(
const std::string & inputShape,
18 const std::string & outputShape,
19 const std::string & blockShapeData,
20 const std::string & cropsData)
25 "operator_codes": [ { "builtin_code": "BATCH_TO_SPACE_ND" } ], 29 "shape": )" + inputShape + R"(, 32 "name": "inputTensor", 41 "shape": )" + outputShape + R"(, 44 "name": "outputTensor", 56 "name": "blockShapeTensor", 68 "name": "cropsTensor", 82 "inputs": [ 0, 2, 3 ], 84 "custom_options_format": "FLEXBUFFERS" 91 { "data": )" + blockShapeData + R"(, }, 92 { "data": )" + cropsData + R"(, }, 100 struct BatchToSpaceNDFixtureTest1 :
public BatchToSpaceNDFixture
102 BatchToSpaceNDFixtureTest1() : BatchToSpaceNDFixture(
"[ 4, 2, 2, 1 ]",
104 "[ 2,0,0,0, 2,0,0,0 ]",
105 "[ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 ]") {}
110 RunTest<4, armnn::DataType::Float32>
131 {{
"outputTensor", { 1.0f, 2.0f, 3.0f, 4.0f,
132 5.0f, 6.0f, 7.0f, 8.0f,
133 9.0f, 10.0f, 11.0f, 12.0f,
134 13.0f, 14.0f, 15.0f, 16.0f }}});
137 struct BatchToSpaceNDFixtureTest2 :
public BatchToSpaceNDFixture
139 BatchToSpaceNDFixtureTest2() : BatchToSpaceNDFixture(
"[ 4, 1, 1, 1 ]",
141 "[ 2,0,0,0, 2,0,0,0 ]",
142 "[ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 ]") {}
147 RunTest<4, armnn::DataType::Float32>
149 {{
"inputTensor", { 1.0f, 2.0f, 3.0f, 4.0f }}},
151 1.0f, 2.0f, 3.0f, 4.0f }}});
154 struct BatchToSpaceNDFixtureTest3 :
public BatchToSpaceNDFixture
156 BatchToSpaceNDFixtureTest3() : BatchToSpaceNDFixture(
"[ 4, 1, 1, 3 ]",
158 "[ 2,0,0,0, 2,0,0,0 ]",
159 "[ 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 ]") {}
164 RunTest<4, armnn::DataType::Float32>
166 {{
"inputTensor", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f }}},
167 {{
"outputTensor", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f }}});
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(BatchToSpaceNDTest1, BatchToSpaceNDFixtureTest1)
BOOST_AUTO_TEST_SUITE_END()