From bceff2fb3fc68bb0aa88b886900c34b77340c826 Mon Sep 17 00:00:00 2001 From: surmeh01 Date: Thu, 29 Mar 2018 16:29:27 +0100 Subject: Release 18.03 --- src/armnnTfParser/test/Identity.cpp | 161 ++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 src/armnnTfParser/test/Identity.cpp (limited to 'src/armnnTfParser/test/Identity.cpp') diff --git a/src/armnnTfParser/test/Identity.cpp b/src/armnnTfParser/test/Identity.cpp new file mode 100644 index 0000000000..ca20de5760 --- /dev/null +++ b/src/armnnTfParser/test/Identity.cpp @@ -0,0 +1,161 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include +#include "armnnTfParser/ITfParser.hpp" +#include "ParserPrototxtFixture.hpp" + +BOOST_AUTO_TEST_SUITE(TensorflowParser) + +struct IdentitySimpleFixture : public ParserPrototxtFixture +{ + IdentitySimpleFixture() + { + m_Prototext = "node{ " + " name: \"Placeholder\"" + " op: \"Placeholder\"" + " attr {" + " key: \"dtype\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + " attr {" + " key: \"shape\"" + " value {" + " shape {" + " unknown_rank: true" + " }" + " }" + " }" + "}" + "node {" + " name: \"Identity\"" + " op: \"Identity\"" + " input: \"Placeholder\"" + " attr {" + " key: \"T\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + "}"; + SetupSingleInputSingleOutput({ 4 }, "Placeholder", "Identity"); + } +}; + +BOOST_FIXTURE_TEST_CASE(IdentitySimple, IdentitySimpleFixture) +{ + RunTest<1>({ 1.0f, 2.0f, 3.0f, 4.0f }, { 1.0f, 2.0f, 3.0f, 4.0f }); +} + +struct IdentityFixture : public ParserPrototxtFixture +{ + IdentityFixture() + { + m_Prototext = "node{ " + " name: \"Placeholder\"" + " op: \"Placeholder\"" + " attr {" + " key: \"dtype\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + " attr {" + " key: \"shape\"" + " value {" + " shape {" + " unknown_rank: true" + " }" + " }" + " }" + "}" + "node {" + " name: \"Identity\"" + " op: \"Identity\"" + " input: \"Placeholder\"" + " attr {" + " key: \"T\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + "}" + "node {" + " name: \"Add\"" + " op: \"Add\"" + " input: \"Identity\"" + " input: \"Identity\"" + " attr {" + " key: \"T\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + "}"; + SetupSingleInputSingleOutput({ 4 }, "Placeholder", "Add"); + } +}; + +BOOST_FIXTURE_TEST_CASE(ParseIdentity, IdentityFixture) +{ + RunTest<1>({ 1.0f, 2.0f, 3.0f, 4.0f }, { 2.0f, 4.0f, 6.0f, 8.0f }); +} + +struct IdentityChainFixture : public ParserPrototxtFixture +{ + IdentityChainFixture() + { + m_Prototext = "node{ " + " name: \"Placeholder\"" + " op: \"Placeholder\"" + " attr {" + " key: \"dtype\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + " attr {" + " key: \"shape\"" + " value {" + " shape {" + " unknown_rank: true" + " }" + " }" + " }" + "}" + "node {" + " name: \"Identity\"" + " op: \"Identity\"" + " input: \"Placeholder\"" + " attr {" + " key: \"T\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + "}" + "node {" + " name: \"Identity2\"" + " op: \"Identity\"" + " input: \"Identity\"" + " attr {" + " key: \"T\"" + " value {" + " type: DT_FLOAT" + " }" + " }" + "}"; + SetupSingleInputSingleOutput({ 4 }, "Placeholder", "Identity2"); + } +}; + +BOOST_FIXTURE_TEST_CASE(IdentityChain, IdentityChainFixture) +{ + RunTest<1>({ 1.0f, 2.0f, 3.0f, 4.0f }, { 1.0f, 2.0f, 3.0f, 4.0f }); +} + +BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1