6 #include <boost/test/unit_test.hpp> 8 #include "../TfLiteParser.hpp" 17 explicit ReshapeFixture(
const std::string& inputShape,
18 const std::string& outputShape,
19 const std::string& newShape)
24 "operator_codes": [ { "builtin_code": "RESHAPE" } ], 29 "shape" : )" + inputShape + ",";
33 "name": "inputTensor", 43 "shape" : )" + outputShape; 47 "name": "outputTensor", 63 "builtin_options_type": "ReshapeOptions", 64 "builtin_options": {)"; 65 if (!newShape.empty())
70 "custom_options_format": "FLEXBUFFERS" 74 "buffers" : [ {}, {} ] 81 struct ReshapeFixtureWithReshapeDims : ReshapeFixture
83 ReshapeFixtureWithReshapeDims() : ReshapeFixture(
"[ 1, 9 ]",
"[ 3, 3 ]",
"[ 3, 3 ]") {}
88 SetupSingleInputSingleOutput(
"inputTensor",
"outputTensor");
89 RunTest<2, armnn::DataType::QAsymmU8>(0,
90 { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
91 { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
92 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
96 struct ReshapeFixtureWithReshapeDimsFlatten : ReshapeFixture
98 ReshapeFixtureWithReshapeDimsFlatten() : ReshapeFixture(
"[ 3, 3 ]",
"[ 9 ]",
"[ -1 ]") {}
103 SetupSingleInputSingleOutput(
"inputTensor",
"outputTensor");
104 RunTest<1, armnn::DataType::QAsymmU8>(0,
105 { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
106 { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
107 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
111 struct ReshapeFixtureWithReshapeDimsFlattenTwoDims : ReshapeFixture
113 ReshapeFixtureWithReshapeDimsFlattenTwoDims() : ReshapeFixture(
"[ 3, 2, 3 ]",
"[ 2, 9 ]",
"[ 2, -1 ]") {}
118 SetupSingleInputSingleOutput(
"inputTensor",
"outputTensor");
119 RunTest<2, armnn::DataType::QAsymmU8>(0,
120 { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 },
121 { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 });
122 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
126 struct ReshapeFixtureWithReshapeDimsFlattenOneDim : ReshapeFixture
128 ReshapeFixtureWithReshapeDimsFlattenOneDim() : ReshapeFixture(
"[ 2, 9 ]",
"[ 2, 3, 3 ]",
"[ 2, -1, 3 ]") {}
133 SetupSingleInputSingleOutput(
"inputTensor",
"outputTensor");
134 RunTest<3, armnn::DataType::QAsymmU8>(0,
135 { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 },
136 { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 });
137 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(ValidReshapeTest, ReshapeValidFixture)
BOOST_AUTO_TEST_SUITE_END()