aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfLiteParser/test
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-05-27 11:06:17 +0100
committerSadik Armagan <sadik.armagan@arm.com>2020-05-27 11:22:09 +0000
commit12239e7291fb04b862e44045be0a4feb7751af62 (patch)
tree0dd982182e0ce34ca36e13bd5e631b62f86974d1 /src/armnnTfLiteParser/test
parent0729b2febd3dfb13686b5aa43c5cea090af329f6 (diff)
downloadarmnn-12239e7291fb04b862e44045be0a4feb7751af62.tar.gz
IVGCVSW-4187 Add LEAKY_RELU to TFLite parser
Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I3e934142487b92897eb487099a22d032f80e8e07
Diffstat (limited to 'src/armnnTfLiteParser/test')
-rw-r--r--src/armnnTfLiteParser/test/LeakyRelu.cpp79
1 files changed, 79 insertions, 0 deletions
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 <boost/test/unit_test.hpp>
+#include "ParserFlatbuffersFixture.hpp"
+#include "../TfLiteParser.hpp"
+
+#include <string>
+#include <iostream>
+
+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()