11 #include <boost/test/unit_test.hpp> 17 explicit LoadScopeDynamicTensorFixture(
const std::string& shape0,
18 const std::string& shape1,
19 const std::string& shape2)
26 "builtin_code": "AVERAGE_POOL_2D", 30 "builtin_code": "SOFTMAX", 38 "shape": )" + shape0 + R"(, 44 "quantized_dimension": 0 49 "shape": )" + shape1 + R"(, 55 "quantized_dimension": 0 60 "shape": )" + shape2 + R"(, 63 "name": "model/average_pooling2d/AvgPool", 66 "quantized_dimension": 0 86 "builtin_options_type": "SoftmaxOptions", 90 "custom_options_format": "FLEXBUFFERS" 100 "builtin_options_type": "Pool2DOptions", 107 "fused_activation_function": "NONE" 109 "custom_options_format": "FLEXBUFFERS" 115 "description": "MLIR Converted.", 132 struct LoadScopeDynamicTensor0Fixture : LoadScopeDynamicTensorFixture
134 LoadScopeDynamicTensor0Fixture() : LoadScopeDynamicTensorFixture(
"[ 1, 2, 3, 2 ]",
"[]",
"[]") {}
137 struct LoadScopeDynamicTensor1Fixture : LoadScopeDynamicTensorFixture
139 LoadScopeDynamicTensor1Fixture() : LoadScopeDynamicTensorFixture(
"[ 1, 2, 4, 1 ]",
"[ 1, 1, 2, 1 ]",
"[]") {}
142 struct LoadScopeDynamicTensor2Fixture : LoadScopeDynamicTensorFixture
144 LoadScopeDynamicTensor2Fixture() : LoadScopeDynamicTensorFixture(
"[ 1, 3, 3, 2 ]",
"[ ]",
"[ 1, 1, 1, 2 ]") {}
149 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
151 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f }} },
152 { {
"output", { 0.26894143f, 0.7310586f }} },
158 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
160 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f }} },
161 { {
"output", { 1.f, 1.f }} },
167 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
169 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f }} },
170 { {
"output", { 0.7772999f, 0.22270015f }} },
176 explicit LoadScopeDynamicTensorBroadcastingFixture(
const std::string& inputShape0,
177 const std::string& inputShape1,
178 const std::string& inputShape2,
179 const std::string& addShape,
180 const std::string& outputShape)
187 "builtin_code": "ADD", 191 "builtin_code": "SUB", 199 "shape": )" + inputShape0 + R"(, 205 "quantized_dimension": 0 210 "shape": )" + inputShape1 + R"(, 216 "quantized_dimension": 0 221 "shape": )" + outputShape + R"(, 227 "quantized_dimension": 0 233 "shape": )" + addShape + R"(, 236 "name": "model/add/add", 239 "quantized_dimension": 0 244 "shape": )" + inputShape2 + R"(, 250 "quantized_dimension": 0 273 "builtin_options_type": "AddOptions", 275 "fused_activation_function": "NONE" 277 "custom_options_format": "FLEXBUFFERS" 288 "builtin_options_type": "SubOptions", 290 "fused_activation_function": "NONE" 292 "custom_options_format": "FLEXBUFFERS" 318 struct LoadScopeDynamicTensorBroadcasting3DFixture : LoadScopeDynamicTensorBroadcastingFixture
320 LoadScopeDynamicTensorBroadcasting3DFixture() : LoadScopeDynamicTensorBroadcastingFixture(
"[ 1, 2, 3, 2 ]",
323 "[ 1, 2, 3, 2 ]",
"[]") {}
326 struct LoadScopeDynamicTensorBroadcasting2DFixture : LoadScopeDynamicTensorBroadcastingFixture
328 LoadScopeDynamicTensorBroadcasting2DFixture() : LoadScopeDynamicTensorBroadcastingFixture(
"[ 1, 2, 3, 2 ]",
334 struct LoadScopeDynamicTensorBroadcasting1DFixture : LoadScopeDynamicTensorBroadcastingFixture
336 LoadScopeDynamicTensorBroadcasting1DFixture() : LoadScopeDynamicTensorBroadcastingFixture(
"[ 1, 2, 3, 2 ]",
345 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
347 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f }},
348 {
"input1", { 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f }},
349 {
"input2", { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f }}
351 { {
"output", { 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 13.f }} },
357 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
359 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f }},
360 {
"input1", { 3.f, 4.f, 5.f, 6.f, 7.f, 8.f }},
361 {
"input2", { -1.f, -2.f, 3.f, 4.f, 5.f, 6.f }}
363 { {
"output", { 4.f, 7.f, 4.f, 5.f, 6.f, 7.f, 10.f, 13.f, 10.f, 11.f, 12.f, 13.f }} },
369 RunTest<4, armnn::DataType::Float32, armnn::DataType::Float32>(
371 { {
"input0", { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f }},
375 { {
"output", { 4.f, 5.f, 6.f, 7.f, 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f }} },
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_CASE(LoadScopeDynamicTensor0, LoadScopeDynamicTensor0Fixture)