aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfParser/test/Rsqrt.cpp
diff options
context:
space:
mode:
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