From 4fcda0101ec3d110c1d6d7bee5c83416b645528a Mon Sep 17 00:00:00 2001 From: telsoa01 Date: Fri, 9 Mar 2018 14:13:49 +0000 Subject: Release 18.02 Change-Id: Id3c11dc5ee94ef664374a988fcc6901e9a232fa6 --- src/armnnCaffeParser/test/TestInPlace.cpp | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/armnnCaffeParser/test/TestInPlace.cpp (limited to 'src/armnnCaffeParser/test/TestInPlace.cpp') diff --git a/src/armnnCaffeParser/test/TestInPlace.cpp b/src/armnnCaffeParser/test/TestInPlace.cpp new file mode 100644 index 0000000000..3954baa75b --- /dev/null +++ b/src/armnnCaffeParser/test/TestInPlace.cpp @@ -0,0 +1,98 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#include +#include "armnnCaffeParser/ICaffeParser.hpp" +#include "ParserPrototxtFixture.hpp" + +BOOST_AUTO_TEST_SUITE(CaffeParser) + +// The pooling layer should take its input from the relu, not the add directly. +struct InPlaceFixture : public ParserPrototxtFixture +{ + InPlaceFixture() + { + m_Prototext = R"( +name: "InPlace" +layer { + name: "data" + type: "Input" + top: "data" + input_param { shape: { dim: 1 dim: 1 dim: 1 dim: 1 } } +} +layer { + bottom: "data" + bottom: "data" + top: "add" + name: "add" + type: "Eltwise" +} +layer { + name: "relu" + type: "ReLU" + bottom: "add" + top: "relu" + phase: TEST +} +layer { + name: "pool" + type: "Pooling" + bottom: "relu" + top: "pool" + phase: TEST + pooling_param { + pool: MAX + kernel_size: 1 + stride: 1 + } +} + )"; + SetupSingleInputSingleOutput("data", "pool"); + } +}; + +BOOST_FIXTURE_TEST_CASE(ParseInPlace, InPlaceFixture) +{ + RunTest<1>({ -1.0f }, { 0.0f }); +} + +// The requested output of the network is a layer which has an activation attached. +// The output of the network should therefore actually be the activation layer. +struct InPlaceOutputFixture : public ParserPrototxtFixture +{ + InPlaceOutputFixture() + { + m_Prototext = R"( +name: "InPlace" +layer { + name: "data" + type: "Input" + top: "data" + input_param { shape: { dim: 1 dim: 1 dim: 1 dim: 1 } } +} +layer { + bottom: "data" + bottom: "data" + top: "add" + name: "add" + type: "Eltwise" +} +layer { + name: "relu" + type: "ReLU" + bottom: "add" + top: "add" + phase: TEST +} + )"; + SetupSingleInputSingleOutput("data", "add"); + } +}; + +BOOST_FIXTURE_TEST_CASE(InPlaceOutput, InPlaceOutputFixture) +{ + RunTest<1>({ -1.0f }, { 0.0f }); +} + +BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1