13 explicit UnpackFixture(
const std::string& inputShape,
14 const unsigned int numberOfOutputs,
15 const std::string& outputShape,
16 const std::string& axis,
17 const std::string& num,
18 const std::string& dataType,
19 const std::string& outputScale,
20 const std::string& outputOffset)
23 std::string outputIndexes =
"1";
24 for(
unsigned int i = 1; i < numberOfOutputs; i++)
26 outputIndexes +=
", " + std::to_string(i+1);
31 "operator_codes": [ { "builtin_code": "UNPACK" } ], 35 "shape": )" + inputShape + R"(, 36 "type": )" + dataType + R"(, 38 "name": "inputTensor", 48 for(
unsigned int i = 0; i < numberOfOutputs; i++)
52 "shape": )" + outputShape + R"( , 53 "type": )" + dataType + R"(, 54 "buffer": )" + std::to_string(i + 1) + R"(, 55 "name": "outputTensor)" + std::to_string(i + 1) + R"(", 59 "scale": [ )" + outputScale + R"( ], 60 "zero_point": [ )" + outputOffset + R"( ], 67 "outputs": [ )" + outputIndexes + R"( ], 72 "outputs": [ )" + outputIndexes + R"( ], 73 "builtin_options_type": "UnpackOptions", 85 "custom_options_format": "FLEXBUFFERS" 99 struct DefaultUnpackAxisZeroFixture : UnpackFixture
101 DefaultUnpackAxisZeroFixture() : UnpackFixture(
"[ 4, 1, 6 ]", 4,
"[ 1, 6 ]",
"0",
"",
"FLOAT32",
"1.0",
"0") {}
104 struct DefaultUnpackAxisZeroUint8Fixture : UnpackFixture
106 DefaultUnpackAxisZeroUint8Fixture() : UnpackFixture(
"[ 4, 1, 6 ]", 4,
"[ 1, 6 ]",
"0",
"",
"UINT8",
"0.1",
"0") {}
109 TEST_CASE_FIXTURE(DefaultUnpackAxisZeroFixture,
"UnpackAxisZeroNumIsDefaultNotSpecified")
111 RunTest<2, armnn::DataType::Float32>(
113 { {
"inputTensor", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f,
114 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f,
115 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
116 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f } } },
117 { {
"outputTensor1", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f }},
118 {
"outputTensor2", { 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f }},
119 {
"outputTensor3", { 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f }},
120 {
"outputTensor4", { 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f }} });
123 TEST_CASE_FIXTURE(DefaultUnpackAxisZeroUint8Fixture,
"UnpackAxisZeroNumIsDefaultNotSpecifiedUint8")
125 RunTest<2, armnn::DataType::QAsymmU8>(
127 { {
"inputTensor", { 1, 2, 3, 4, 5, 6,
129 13, 14, 15, 16, 17, 18,
130 19, 20, 21, 22, 23, 24 } } },
131 { {
"outputTensor1", { 10, 20, 30, 40, 50, 60 }},
132 {
"outputTensor2", { 70, 80, 90, 100, 110, 120 }},
133 {
"outputTensor3", { 130, 140, 150, 160, 170, 180 }},
134 {
"outputTensor4", { 190, 200, 210, 220, 230, 240 }} });
137 struct DefaultUnpackLastAxisFixture : UnpackFixture
139 DefaultUnpackLastAxisFixture() : UnpackFixture(
"[ 4, 1, 6 ]", 6,
"[ 4, 1 ]",
"2",
"6",
"FLOAT32",
"1.0",
"0") {}
142 struct DefaultUnpackLastAxisUint8Fixture : UnpackFixture
144 DefaultUnpackLastAxisUint8Fixture() : UnpackFixture(
"[ 4, 1, 6 ]", 6,
"[ 4, 1 ]",
"2",
"6",
"UINT8",
"0.1",
"0") {}
149 RunTest<2, armnn::DataType::Float32>(
151 { {
"inputTensor", { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f,
152 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f,
153 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
154 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f } } },
155 { {
"outputTensor1", { 1.0f, 7.0f, 13.0f, 19.0f }},
156 {
"outputTensor2", { 2.0f, 8.0f, 14.0f, 20.0f }},
157 {
"outputTensor3", { 3.0f, 9.0f, 15.0f, 21.0f }},
158 {
"outputTensor4", { 4.0f, 10.0f, 16.0f, 22.0f }},
159 {
"outputTensor5", { 5.0f, 11.0f, 17.0f, 23.0f }},
160 {
"outputTensor6", { 6.0f, 12.0f, 18.0f, 24.0f }} });
163 TEST_CASE_FIXTURE(DefaultUnpackLastAxisUint8Fixture,
"UnpackLastAxisNumSixUint8") {
164 RunTest<2, armnn::DataType::QAsymmU8>(
166 {{
"inputTensor", { 1, 2, 3, 4, 5, 6,
168 13, 14, 15, 16, 17, 18,
169 19, 20, 21, 22, 23, 24 }}},
170 {{
"outputTensor1", { 10, 70, 130, 190 }},
171 {
"outputTensor2", { 20, 80, 140, 200 }},
172 {
"outputTensor3", { 30, 90, 150, 210 }},
173 {
"outputTensor4", { 40, 100, 160, 220 }},
174 {
"outputTensor5", { 50, 110, 170, 230 }},
175 {
"outputTensor6", { 60, 120, 180, 240 }}});
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
void Setup(bool testDynamic=true)