diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-10-16 17:45:38 +0100 |
---|---|---|
committer | Áron Virginás-Tar <aron.virginas-tar@arm.com> | 2019-10-21 08:52:04 +0000 |
commit | 77bfb5e32faadb1383d48364a6f54adbff84ad80 (patch) | |
tree | 0bf5dfb48cb8d5c248baf716f02b9f481400316e /src/backends/backendsCommon/test/ArithmeticTestImpl.hpp | |
parent | 5884708e650a80e355398532bc320bbabdbb53f4 (diff) | |
download | armnn-77bfb5e32faadb1383d48364a6f54adbff84ad80.tar.gz |
IVGCVSW-3993 Add frontend and reference workload for ComparisonLayer
* Added frontend for ComparisonLayer
* Added RefComparisonWorkload
* Deprecated and removed Equal and Greater layers and workloads
* Updated tests to ensure backward compatibility
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: Id50c880be1b567c531efff919c0c366d0a71cbe9
Diffstat (limited to 'src/backends/backendsCommon/test/ArithmeticTestImpl.hpp')
-rw-r--r-- | src/backends/backendsCommon/test/ArithmeticTestImpl.hpp | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/src/backends/backendsCommon/test/ArithmeticTestImpl.hpp b/src/backends/backendsCommon/test/ArithmeticTestImpl.hpp deleted file mode 100644 index d0e85dd31d..0000000000 --- a/src/backends/backendsCommon/test/ArithmeticTestImpl.hpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// -#pragma once - -#include "CommonTestUtils.hpp" - -#include <ResolveType.hpp> - -#include <armnn/INetwork.hpp> - -#include <boost/test/unit_test.hpp> - -#include <vector> - -namespace -{ - -template<armnn::DataType ArmnnTypeInput, armnn::DataType ArmnnTypeOutput> -INetworkPtr CreateArithmeticNetwork(const std::vector<TensorShape>& inputShapes, - const TensorShape& outputShape, - const LayerType type, - const float qScale = 1.0f, - const int32_t qOffset = 0) -{ - using namespace armnn; - - // Builds up the structure of the network. - INetworkPtr net(INetwork::Create()); - - IConnectableLayer* arithmeticLayer = nullptr; - - switch(type){ - case LayerType::Equal: arithmeticLayer = net->AddEqualLayer("equal"); break; - case LayerType::Greater: arithmeticLayer = net->AddGreaterLayer("greater"); break; - default: BOOST_TEST_FAIL("Non-Arithmetic layer type called."); - } - - for (unsigned int i = 0; i < inputShapes.size(); ++i) - { - TensorInfo inputTensorInfo(inputShapes[i], ArmnnTypeInput, qScale, qOffset); - IConnectableLayer* input = net->AddInputLayer(boost::numeric_cast<LayerBindingId>(i)); - Connect(input, arithmeticLayer, inputTensorInfo, 0, i); - } - - TensorInfo outputTensorInfo(outputShape, ArmnnTypeOutput, qScale, qOffset); - IConnectableLayer* output = net->AddOutputLayer(0, "output"); - Connect(arithmeticLayer, output, outputTensorInfo, 0, 0); - - return net; -} - -template<armnn::DataType ArmnnInputType, - armnn::DataType ArmnnOutputType, - typename TInput = armnn::ResolveType<ArmnnInputType>, - typename TOutput = armnn::ResolveType<ArmnnOutputType>> -void ArithmeticSimpleEndToEnd(const std::vector<BackendId>& backends, - const LayerType type, - const std::vector<TOutput> expectedOutput) -{ - using namespace armnn; - - const std::vector<TensorShape> inputShapes{{ 2, 2, 2, 2 }, { 2, 2, 2, 2 }}; - const TensorShape& outputShape = { 2, 2, 2, 2 }; - - // Builds up the structure of the network - INetworkPtr net = CreateArithmeticNetwork<ArmnnInputType, ArmnnOutputType>(inputShapes, outputShape, type); - - BOOST_TEST_CHECKPOINT("create a network"); - - const std::vector<TInput> input0({ 1, 1, 1, 1, 5, 5, 5, 5, - 3, 3, 3, 3, 4, 4, 4, 4 }); - - const std::vector<TInput> input1({ 1, 1, 1, 1, 3, 3, 3, 3, - 5, 5, 5, 5, 4, 4, 4, 4 }); - - std::map<int, std::vector<TInput>> inputTensorData = {{ 0, input0 }, { 1, input1 }}; - std::map<int, std::vector<TOutput>> expectedOutputData = {{ 0, expectedOutput }}; - - EndToEndLayerTestImpl<ArmnnInputType, ArmnnOutputType>(move(net), inputTensorData, expectedOutputData, backends); -} - -template<armnn::DataType ArmnnInputType, - armnn::DataType ArmnnOutputType, - typename TInput = armnn::ResolveType<ArmnnInputType>, - typename TOutput = armnn::ResolveType<ArmnnOutputType>> -void ArithmeticBroadcastEndToEnd(const std::vector<BackendId>& backends, - const LayerType type, - const std::vector<TOutput> expectedOutput) -{ - using namespace armnn; - - const std::vector<TensorShape> inputShapes{{ 1, 2, 2, 3 }, { 1, 1, 1, 3 }}; - const TensorShape& outputShape = { 1, 2, 2, 3 }; - - // Builds up the structure of the network - INetworkPtr net = CreateArithmeticNetwork<ArmnnInputType, ArmnnOutputType>(inputShapes, outputShape, type); - - BOOST_TEST_CHECKPOINT("create a network"); - - const std::vector<TInput> input0({ 1, 2, 3, 1, 0, 6, - 7, 8, 9, 10, 11, 12 }); - - const std::vector<TInput> input1({ 1, 1, 3 }); - - std::map<int, std::vector<TInput>> inputTensorData = {{ 0, input0 }, { 1, input1 }}; - std::map<int, std::vector<TOutput>> expectedOutputData = {{ 0, expectedOutput }}; - - EndToEndLayerTestImpl<ArmnnInputType, ArmnnOutputType>(move(net), inputTensorData, expectedOutputData, backends); -} - -} // anonymous namespace |