diff options
author | Teresa Charlin <teresa.charlinreyes@arm.com> | 2023-02-24 18:17:31 +0000 |
---|---|---|
committer | Teresa Charlin <teresa.charlinreyes@arm.com> | 2023-02-24 18:17:31 +0000 |
commit | 2a764ade6b5bf88cba0c43303291e0352ec3354c (patch) | |
tree | 32fd02b854347dded28e2ac0ef7e0805d58950b0 /src/armnnTfLiteParser/test | |
parent | f0a35b8552ffcc39c5ebe2efc1ced15f813d8c09 (diff) | |
download | armnn-2a764ade6b5bf88cba0c43303291e0352ec3354c.tar.gz |
IVGCVSW-7546 SPACE_TO_DEPTH support added in tflite parser
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: I4f5016841c31b183440f31c1e177bc41d2b8dbb7
Diffstat (limited to 'src/armnnTfLiteParser/test')
-rw-r--r-- | src/armnnTfLiteParser/test/SpaceToDepth.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/armnnTfLiteParser/test/SpaceToDepth.cpp b/src/armnnTfLiteParser/test/SpaceToDepth.cpp new file mode 100644 index 0000000000..5f9e32d202 --- /dev/null +++ b/src/armnnTfLiteParser/test/SpaceToDepth.cpp @@ -0,0 +1,88 @@ +// +// Copyright © 2023 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "ParserFlatbuffersFixture.hpp" + + +TEST_SUITE("TensorflowLiteParser_SpaceToDepth") +{ +struct SpaceToDepthFixture : public ParserFlatbuffersFixture +{ + explicit SpaceToDepthFixture(const std::string& inputShape, + const std::string& outputShape, + const std::string& dataType = "FLOAT32", + const std::string& scale = "1.0", + const std::string& offset = "0") + { + m_JsonString = R"( + { + "version": 3, + "operator_codes": [ { "builtin_code": "DEPTH_TO_SPACE" } ], + "subgraphs": [ { + "tensors": [ + { + "shape": )" + inputShape + R"(, + "type": )" + dataType + R"(, + "buffer": 0, + "name": "inputTensor", + "quantization": { + "min": [ 0.0 ], + "max": [ 255.0 ], + "scale": [ )" + scale + R"( ], + "zero_point": [ )" + offset + R"( ], + } + }, + { + "shape": )" + outputShape + R"(, + "type": )" + dataType + R"(, + "buffer": 1, + "name": "outputTensor", + "quantization": { + "min": [ 0.0 ], + "max": [ 255.0 ], + "scale": [ )" + scale + R"( ], + "zero_point": [ )" + offset + R"( ], + } + } + ], + "inputs": [ 0 ], + "outputs": [ 1 ], + "operators": [ + { + "opcode_index": 0, + "inputs": [ 0 ], + "outputs": [ 1 ], + "builtin_options_type": "SpaceToDepthOptions", + "builtin_options": { + "block_size": 2 + }, + "custom_options_format": "FLEXBUFFERS" + } + ], + } ], + "buffers" : [ + { }, + { }, + ] + } + )"; + SetupSingleInputSingleOutput("inputTensor", "outputTensor"); + } +}; + +struct SimpleSpaceToDepthFixture : public SpaceToDepthFixture +{ + SimpleSpaceToDepthFixture() : SpaceToDepthFixture("[ 1, 2, 2, 1 ]", "[ 1, 1, 1, 4 ]") {} +}; + +TEST_CASE_FIXTURE(SimpleSpaceToDepthFixture, "ParseSpaceToDepth") +{ + RunTest<4, armnn::DataType::Float32> + (0, + {{ "inputTensor", { 1.f, 2.f, 3.f, 4.f }}}, + {{ "outputTensor", { 1.f, 2.f, 3.f, 4.f }}} ); +} + +} |