aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfParser/test/Rsqrt.cpp
diff options
context:
space:
mode:
authorMohamed Nour Abouelseoud <mohamednour.abouelseoud@arm.com>2019-01-09 14:19:58 +0000
committerMohamed Nour Abouelseoud <mohamednour.abouelseoud@arm.com>2019-01-09 16:05:21 +0000
commit7a8892fe7c208cce76017acbabdd137c872ddadc (patch)
tree24e10ce244973ce345ff7bd5d78a522c8c1f067f /src/armnnTfParser/test/Rsqrt.cpp
parent9292aa3c71301a8989caaed6c9ad18e2190a8baa (diff)
downloadarmnn-7a8892fe7c208cce76017acbabdd137c872ddadc.tar.gz
IVGCVSW-2345 Add Rsqrt support in Tensorflow Parser
Change-Id: I7c7b65bd77b06925efdaf2c9c98c30994a12de42
Diffstat (limited to 'src/armnnTfParser/test/Rsqrt.cpp')
-rw-r--r--src/armnnTfParser/test/Rsqrt.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/armnnTfParser/test/Rsqrt.cpp b/src/armnnTfParser/test/Rsqrt.cpp
new file mode 100644
index 0000000000..6924c060a6
--- /dev/null
+++ b/src/armnnTfParser/test/Rsqrt.cpp
@@ -0,0 +1,59 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <boost/test/unit_test.hpp>
+#include "armnnTfParser/ITfParser.hpp"
+#include "ParserPrototxtFixture.hpp"
+
+BOOST_AUTO_TEST_SUITE(TensorflowParser)
+
+struct RsqrtFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
+{
+ RsqrtFixture()
+ {
+ m_Prototext = "node {\n"
+ " name: \"input\"\n"
+ " op: \"Placeholder\"\n"
+ " attr {\n"
+ " key: \"dtype\"\n"
+ " value {\n"
+ " type: DT_FLOAT\n"
+ " }\n"
+ " }\n"
+ " attr {\n"
+ " key: \"shape\"\n"
+ " value {\n"
+ " shape {\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ "}\n"
+ "node {\n"
+ " name: \"Rsqrt\"\n"
+ " op: \"Rsqrt\"\n"
+ " input: \"input\"\n"
+ " attr {\n"
+ " key: \"T\"\n"
+ " value {\n"
+ " type: DT_FLOAT\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ SetupSingleInputSingleOutput({ 2, 2 }, "input", "Rsqrt");
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(ParseRsqrt, RsqrtFixture)
+{
+ RunTest<2>({ 1.f, 4.f, 16.f, 25.f }, { 1.f, 0.5f, 0.25f, 0.2f });
+}
+
+BOOST_FIXTURE_TEST_CASE(ParseRsqrtZeroNegative, RsqrtFixture)
+{
+ RunTest<2>({ 0.f, -0.f, -25.f, -16.f }, { INFINITY, -INFINITY, -NAN, -NAN });
+}
+
+BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file