diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-03-29 16:29:27 +0100 |
---|---|---|
committer | surmeh01 <surabhi.mehta@arm.com> | 2018-03-29 16:29:27 +0100 |
commit | bceff2fb3fc68bb0aa88b886900c34b77340c826 (patch) | |
tree | d867d3e090d58d3012dfbbac456e9ea8c7f789bc /src/armnnTfParser/test/MultiOutput.cpp | |
parent | 4fcda0101ec3d110c1d6d7bee5c83416b645528a (diff) | |
download | armnn-bceff2fb3fc68bb0aa88b886900c34b77340c826.tar.gz |
Release 18.03
Diffstat (limited to 'src/armnnTfParser/test/MultiOutput.cpp')
-rw-r--r-- | src/armnnTfParser/test/MultiOutput.cpp | 144 |
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 |