9 #include <boost/test/unit_test.hpp> 16 std::string ConvertInt32VectorToOctalString(
const std::vector<unsigned int>& data)
20 std::for_each(data.begin(), data.end(), [&ss](
unsigned int d) {
21 ss << armnnUtils::ConvertInt32ToOctalString(static_cast<int>(d));
31 const std::vector<unsigned int>& permuteVectorData)
34 armnn::TensorShape permuteVectorShape({
static_cast<unsigned int>(permuteVectorData.size())});
38 " op: \"Placeholder\"\n" 56 " name: \"transpose/perm\"\n" 76 m_Prototext.append(ConvertInt32VectorToOctalString(permuteVectorData) +
"\n");
86 " op: \"Transpose\"\n" 88 " input: \"transpose/perm\"\n" 103 Setup({{
"input", inputShape}}, {
"output"});
107 struct TransposeFixtureWithPermuteData : TransposeFixture
109 TransposeFixtureWithPermuteData()
110 : TransposeFixture({2, 2, 3, 4},
111 std::vector<unsigned int>({1, 3, 2, 0})) {}
117 {{
"input", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
118 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
119 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}}},
120 {{
"output", {0, 24, 4, 28, 8, 32, 1, 25, 5, 29, 9, 33, 2, 26, 6,
121 30, 10, 34, 3, 27, 7, 31, 11, 35, 12, 36, 16, 40, 20, 44, 13, 37,
122 17, 41, 21, 45, 14, 38, 18, 42, 22, 46, 15, 39, 19, 43, 23, 47}}});
124 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(
"output").second.GetShape()
128 struct TransposeFixtureWithoutPermuteData : TransposeFixture
132 TransposeFixtureWithoutPermuteData()
133 : TransposeFixture({2, 2, 3, 4},
134 std::vector<unsigned int>({3, 2, 1, 0})) {}
140 {{
"input", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
141 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
142 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}}},
143 {{
"output", {0, 24, 12, 36, 4, 28, 16, 40, 8, 32, 20, 44, 1, 25,
144 13, 37, 5, 29, 17, 41, 9, 33, 21, 45, 2, 26, 14, 38, 6, 30, 18,
145 42,10, 34, 22, 46, 3, 27, 15, 39, 7, 31, 19, 43, 11, 35, 23, 47}}});
147 BOOST_TEST((m_Parser->GetNetworkOutputBindingInfo(
"output").second.GetShape()
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(TransposeWithPermuteData, TransposeFixtureWithPermuteData)
BOOST_AUTO_TEST_SUITE_END()
std::string ConvertTensorShapeToString(const armnn::TensorShape &shape)
Converts an TensorShape into Prototxt representation.