From 12239e7291fb04b862e44045be0a4feb7751af62 Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 27 May 2020 11:06:17 +0100 Subject: IVGCVSW-4187 Add LEAKY_RELU to TFLite parser Signed-off-by: Nikhil Raj Signed-off-by: Sadik Armagan Change-Id: I3e934142487b92897eb487099a22d032f80e8e07 --- src/armnnTfLiteParser/test/LeakyRelu.cpp | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/armnnTfLiteParser/test/LeakyRelu.cpp (limited to 'src/armnnTfLiteParser/test') diff --git a/src/armnnTfLiteParser/test/LeakyRelu.cpp b/src/armnnTfLiteParser/test/LeakyRelu.cpp new file mode 100644 index 0000000000..471c01444c --- /dev/null +++ b/src/armnnTfLiteParser/test/LeakyRelu.cpp @@ -0,0 +1,79 @@ +// +// Copyright © 2020 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include +#include "ParserFlatbuffersFixture.hpp" +#include "../TfLiteParser.hpp" + +#include +#include + +BOOST_AUTO_TEST_SUITE(TensorflowLiteParser) + +struct LeakyReluFixture : public ParserFlatbuffersFixture +{ + explicit LeakyReluFixture() + { + m_JsonString = R"( + { + "version": 3, + "operator_codes": [ { "builtin_code": "LEAKY_RELU" } ], + "subgraphs": [ { + "tensors": [ + { + "shape": [ 1, 7 ], + "type": "FLOAT32", + "buffer": 0, + "name": "inputTensor", + "quantization": { + "min": [ 0.0 ], + "max": [ 255.0 ], + "scale": [ 1.0 ], + "zero_point": [ 0 ], + } + }, + { + "shape": [ 1, 7 ], + "type": "FLOAT32", + "buffer": 1, + "name": "outputTensor", + "quantization": { + "min": [ 0.0 ], + "max": [ 255.0 ], + "scale": [ 1.0 ], + "zero_point": [ 0 ], + } + } + ], + "inputs": [ 0 ], + "outputs": [ 1 ], + "operators": [ + { + "opcode_index": 0, + "inputs": [ 0 ], + "outputs": [ 1 ], + "builtin_options_type": "LeakyReluOptions", + "builtin_options": { + "alpha": 0.01 + }, + "custom_options_format": "FLEXBUFFERS" + } + ], + } ], + "buffers" : [ {}, {} ] + } + )"; + SetupSingleInputSingleOutput("inputTensor", "outputTensor"); + } +}; + +BOOST_FIXTURE_TEST_CASE(ParseLeakyRelu, LeakyReluFixture) +{ + RunTest<2, armnn::DataType::Float32>(0, + {{ "inputTensor", { -0.1f, -0.2f, -0.3f, -0.4f, 0.1f, 0.2f, 0.3f }}}, + {{ "outputTensor", { -0.001f, -0.002f, -0.003f, -0.004f, 0.1f, 0.2f, 0.3f }}}); +} + +BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1