aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfParser/test/MultiOutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnnTfParser/test/MultiOutput.cpp')
-rw-r--r--src/armnnTfParser/test/MultiOutput.cpp144
1 files changed, 144 insertions, 0 deletions
diff --git a/src/armnnTfParser/test/MultiOutput.cpp b/src/armnnTfParser/test/MultiOutput.cpp
new file mode 100644
index 0000000000..56be33dab7
--- /dev/null
+++ b/src/armnnTfParser/test/MultiOutput.cpp
@@ -0,0 +1,144 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+#include <boost/test/unit_test.hpp>
+#include "armnnTfParser/ITfParser.hpp"
+#include "ParserPrototxtFixture.hpp"
+
+BOOST_AUTO_TEST_SUITE(TensorflowParser)
+
+struct MultiOutMatchFixture : public ParserPrototxtFixture<armnnTfParser::ITfParser>
+{
+ MultiOutMatchFixture()
+ {
+ m_Prototext = R"(
+node {
+ name: "input"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ }
+ }
+ }
+}
+node {
+ name: "softmax1"
+ op: "Softmax"
+ input: "input:0"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
+ )";
+ SetupSingleInputSingleOutput({ 1, 7 }, "input", "softmax1");
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(MultiOutMatch, MultiOutMatchFixture)
+{
+ // Note that the point of this test is to verify the parsing went well.
+ // Here we make sure the softmax has really connected to the input layer.
+ RunTest<2>({ 0, 0, 10000, 0, 0, 0, 0 }, { 0, 0, 1, 0, 0, 0, 0 });
+}
+
+struct MultiOutFailFixture : public ParserPrototxtFixture<armnnTfParser::ITfParser>
+{
+ MultiOutFailFixture()
+ {
+ m_Prototext = R"(
+node {
+ name: "input"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ }
+ }
+ }
+}
+node {
+ name: "softmax1"
+ op: "Softmax"
+ input: "input:1"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
+ )";
+ BOOST_CHECK_THROW(SetupSingleInputSingleOutput({ 1, 7 }, "input", "softmax1"), armnn::ParseException);
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(MultiOutFail, MultiOutFailFixture)
+{
+ // Not running the graph because this is expected to throw an exception during parsing.
+}
+
+struct MultiOutInvalidFixture : public ParserPrototxtFixture<armnnTfParser::ITfParser>
+{
+ MultiOutInvalidFixture()
+ {
+ m_Prototext = R"(
+node {
+ name: "input"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ }
+ }
+ }
+}
+node {
+ name: "softmax1"
+ op: "Softmax"
+ input: "input:-1"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
+ )";
+ BOOST_CHECK_THROW(SetupSingleInputSingleOutput({ 1, 7 }, "input", "softmax1"), armnn::ParseException);
+ }
+};
+
+BOOST_FIXTURE_TEST_CASE(MultiOutInvalid, MultiOutInvalidFixture)
+{
+ // Not running the graph because this is expected to throw an exception during parsing.
+}
+
+
+BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file