2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include <boost/test/unit_test.hpp>
7 #include "ParserFlatbuffersSerializeFixture.hpp"
8 #include <armnnDeserializer/IDeserializer.hpp>
12 BOOST_AUTO_TEST_SUITE(Deserializer)
14 struct TransposeFixture : public ParserFlatbuffersSerializeFixture
16 explicit TransposeFixture(const std::string &inputShape,
17 const std::string &dimMappings,
18 const std::string &outputShape,
19 const std::string &dataType)
27 layer_type: "InputLayer",
33 layerName: "InputLayer",
37 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
42 dimensions: )" + inputShape + R"(,
43 dataType: )" + dataType + R"(
51 layer_type: "TransposeLayer",
55 layerName: "TransposeLayer",
56 layerType: "Transpose",
59 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
64 dimensions: )" + outputShape + R"(,
65 dataType: )" + dataType + R"(
70 dimMappings: )" + dimMappings + R"(,
75 layer_type: "OutputLayer",
81 layerName: "OutputLayer",
85 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
90 dimensions: )" + outputShape + R"(,
91 dataType: )" + dataType + R"(
101 SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
105 struct SimpleTranspose2DFixture : TransposeFixture
107 SimpleTranspose2DFixture() : TransposeFixture("[ 2, 3 ]",
110 "QuantisedAsymm8") {}
113 BOOST_FIXTURE_TEST_CASE(SimpleTranspose2DQuantisedAsymm8, SimpleTranspose2DFixture)
115 RunTest<2, armnn::DataType::QAsymmU8>(0,
116 { 1, 2, 3, 4, 5, 6 },
117 { 1, 4, 2, 5, 3, 6 });
120 struct SimpleTranspose4DFixture : TransposeFixture
122 SimpleTranspose4DFixture() : TransposeFixture("[ 1, 2, 3, 4 ]",
125 "QuantisedAsymm8") {}
128 BOOST_FIXTURE_TEST_CASE(SimpleTranspose4DQuantisedAsymm8, SimpleTranspose4DFixture)
130 RunTest<4, armnn::DataType::QAsymmU8>(0,
131 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
132 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 },
133 { 1, 13, 5, 17, 9, 21, 2, 14, 6, 18, 10, 22,
134 3, 15, 7, 19, 11, 23, 4, 16, 8, 20, 12, 24 });
137 BOOST_AUTO_TEST_SUITE_END()