6 #include <boost/test/unit_test.hpp> 8 #include "../TfLiteParser.hpp" 14 explicit TransposeFixture(
const std::string & inputShape,
15 const std::string & permuteData,
16 const std::string & outputShape)
23 "builtin_code": "TRANSPOSE", 31 "shape": )" + inputShape + R"(, 34 "name": "inputTensor", 43 "quantized_dimension": 0 48 "shape": )" + outputShape + R"(, 51 "name": "outputTensor", 54 "quantized_dimension": 0 65 "name": "permuteTensor", 68 "quantized_dimension": 0 89 "builtin_options_type": "TransposeOptions", 92 "custom_options_format": "FLEXBUFFERS" 97 "description": "TOCO Converted.", 101 if (!permuteData.empty())
103 m_JsonString += R
"(,{"data": )" + permuteData + R"( })"; 114 struct TransposeFixtureWithPermuteData : TransposeFixture
116 TransposeFixtureWithPermuteData() : TransposeFixture(
"[ 2, 2, 3 ]",
117 "[ 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0 ]",
123 RunTest<3, armnn::DataType::Float32>(
125 {{
"inputTensor", { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }}},
126 {{
"outputTensor", { 1, 4, 2, 5, 3, 6, 7, 10, 8, 11, 9, 12 }}});
128 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
135 struct TransposeFixtureWithoutPermuteData : TransposeFixture
137 TransposeFixtureWithoutPermuteData() : TransposeFixture(
"[ 2, 2, 3 ]",
138 "[ 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]",
144 RunTest<3, armnn::DataType::Float32>(
146 {{
"inputTensor", { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }}},
147 {{
"outputTensor", { 1, 7, 4, 10, 2, 8, 5, 11, 3, 9, 6, 12 }}});
149 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(0,
"outputTensor").second.GetShape()
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(TransposeWithPermuteData, TransposeFixtureWithPermuteData)
BOOST_AUTO_TEST_SUITE_END()