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/PassThru.cpp | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/armnnTfParser/test/PassThru.cpp (limited to 'src/armnnTfParser/test/PassThru.cpp') diff --git a/src/armnnTfParser/test/PassThru.cpp b/src/armnnTfParser/test/PassThru.cpp new file mode 100644 index 0000000000..8462ec27cc --- /dev/null +++ b/src/armnnTfParser/test/PassThru.cpp @@ -0,0 +1,52 @@ +// +// 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 PassThruFixture : public ParserPrototxtFixture +{ + PassThruFixture() + { + m_Prototext = "node {\n" + " name: \"Placeholder\"\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"; + SetupSingleInputSingleOutput({ 1, 7 }, "Placeholder", "Placeholder"); + } +}; + +BOOST_FIXTURE_TEST_CASE(ValidateOutput, PassThruFixture) +{ + BOOST_TEST(m_Parser->GetNetworkOutputBindingInfo("Placeholder").second.GetNumDimensions() == 2); + BOOST_TEST(m_Parser->GetNetworkOutputBindingInfo("Placeholder").second.GetShape()[0] == 1); + BOOST_TEST(m_Parser->GetNetworkOutputBindingInfo("Placeholder").second.GetShape()[1] == 7); +} + +BOOST_FIXTURE_TEST_CASE(RunGraph, PassThruFixture) +{ + armnn::TensorInfo inputTensorInfo = m_Parser->GetNetworkInputBindingInfo("Placeholder").second; + auto input = MakeRandomTensor(inputTensorInfo, 378346); + std::vector inputVec; + inputVec.assign(input.data(), input.data() + input.num_elements()); + RunTest<2>(inputVec, inputVec); // The passthru network should output the same as the input +} + +BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1