aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test/MergerTestImpl.hpp
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2019-05-22 14:24:13 +0100
committerJim Flynn <jim.flynn@arm.com>2019-05-28 17:50:33 +0100
commite242f2dc646f41e9162aaaf74e057ce39fcb92df (patch)
treed6c49b559c34d1d306b1e901501dded1c18f71c5 /src/backends/backendsCommon/test/MergerTestImpl.hpp
parent2f2778f36e59537bbd47fb8b21e73c6c5a949584 (diff)
downloadarmnn-e242f2dc646f41e9162aaaf74e057ce39fcb92df.tar.gz
IVGCVSW-3119 Rename MergerLayer to ConcatLayer
!android-nn-driver:1210 Change-Id: I940b3b9e421c92bfd55ae996f7bc54ac077f2604 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/backends/backendsCommon/test/MergerTestImpl.hpp')
-rw-r--r--src/backends/backendsCommon/test/MergerTestImpl.hpp309
1 files changed, 0 insertions, 309 deletions
diff --git a/src/backends/backendsCommon/test/MergerTestImpl.hpp b/src/backends/backendsCommon/test/MergerTestImpl.hpp
deleted file mode 100644
index 8483cf02d8..0000000000
--- a/src/backends/backendsCommon/test/MergerTestImpl.hpp
+++ /dev/null
@@ -1,309 +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<typename armnn::DataType DataType>
-INetworkPtr CreateMergerNetwork(const std::vector<TensorShape>& inputShapes,
- const TensorShape& outputShape,
- unsigned int concatAxis,
- const float qScale = 1.0f,
- const int32_t qOffset = 0)
-{
- using namespace armnn;
- // Builds up the structure of the network.
- INetworkPtr net(INetwork::Create());
-
- OriginsDescriptor descriptor;
-
- descriptor = CreateDescriptorForConcatenation(inputShapes.begin(),
- inputShapes.end(),
- concatAxis);
- ARMNN_NO_DEPRECATE_WARN_BEGIN
- IConnectableLayer* merger = net->AddMergerLayer(descriptor, "merger");
- ARMNN_NO_DEPRECATE_WARN_END
-
- for (unsigned int i = 0; i < inputShapes.size(); ++i)
- {
- TensorInfo inputTensorInfo(inputShapes[i], DataType, qScale, qOffset);
- IConnectableLayer* input = net->AddInputLayer(boost::numeric_cast<LayerBindingId>(i));
- Connect(input, merger, inputTensorInfo, 0, i);
- }
-
- TensorInfo outputTensorInfo(outputShape, DataType, qScale, qOffset);
- IConnectableLayer* output = net->AddOutputLayer(0, "output");
- Connect(merger, output, outputTensorInfo, 0, 0);
-
- return net;
-}
-
-template<armnn::DataType ArmnnType>
-void MergerDim0EndToEnd(const std::vector<BackendId>& backends)
-{
- using namespace armnn;
- using T = ResolveType<ArmnnType>;
-
- unsigned int concatAxis = 0;
- const std::vector<TensorShape> inputShapes{{ 2, 3, 2, 2 }, { 2, 3, 2, 2 }};
- const TensorShape& outputShape = { 4, 3, 2, 2 };
-
- // Builds up the structure of the network
- INetworkPtr net = CreateMergerNetwork<ArmnnType>(inputShapes, outputShape, concatAxis);
-
- BOOST_TEST_CHECKPOINT("create a network");
-
- // Creates structures for input & output.
- std::vector<T> inputData{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::vector<T> expectedOutput{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::map<int, std::vector<T>> inputTensorData = {{ 0,inputData }, { 1,inputData }};
- std::map<int, std::vector<T>> expectedOutputData = {{ 0,expectedOutput }};
-
- EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
-}
-
-template<armnn::DataType ArmnnType>
-void MergerDim1EndToEnd(const std::vector<BackendId>& backends)
-{
- using namespace armnn;
- using T = ResolveType<ArmnnType>;
-
- unsigned int concatAxis = 1;
- const std::vector<TensorShape> inputShapes{{ 2, 3, 2, 2 }, { 2, 3, 2, 2 }};
- const TensorShape& outputShape = { 2, 6, 2, 2 };
-
- // Builds up the structure of the network
- INetworkPtr net = CreateMergerNetwork<ArmnnType>(inputShapes, outputShape, concatAxis);
-
- BOOST_TEST_CHECKPOINT("create a network");
-
- // Creates structures for input & output.
- std::vector<T> inputData{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::vector<T> expectedOutput{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::map<int, std::vector<T>> inputTensorData = {{ 0,inputData }, { 1,inputData }};
- std::map<int, std::vector<T>> expectedOutputData = {{ 0,expectedOutput }};
-
- EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
-}
-
-template<armnn::DataType ArmnnType>
-void MergerDim2EndToEnd(const std::vector<BackendId>& backends)
-{
- using namespace armnn;
- using T = ResolveType<ArmnnType>;
-
- unsigned int concatAxis = 2;
- const std::vector<TensorShape> inputShapes{{ 2, 3, 2, 2 }, { 2, 3, 2, 2 }};
- const TensorShape& outputShape = { 2, 3, 4, 2 };
-
- // Builds up the structure of the network
- INetworkPtr net = CreateMergerNetwork<ArmnnType>(inputShapes, outputShape, concatAxis);
-
- BOOST_TEST_CHECKPOINT("create a network");
-
- // Creates structures for input & output.
- std::vector<T> inputData{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::vector<T> expectedOutput{
- 1, 2,
- 3, 4,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 9, 10,
- 11, 12
- };
-
- std::map<int, std::vector<T>> inputTensorData = {{ 0,inputData }, { 1,inputData }};
- std::map<int, std::vector<T>> expectedOutputData = {{ 0,expectedOutput }};
-
- EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
-}
-
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
-void MergerDim3EndToEnd(const std::vector<BackendId>& backends)
-{
- using namespace armnn;
-
- unsigned int concatAxis = 3;
- const std::vector<TensorShape> inputShapes{{ 2, 3, 2, 2 }, { 2, 3, 2, 2 }};
- const TensorShape& outputShape = { 2, 3, 2, 4 };
-
- // Builds up the structure of the network
- INetworkPtr net = CreateMergerNetwork<ArmnnType>(inputShapes, outputShape, concatAxis);
-
- BOOST_TEST_CHECKPOINT("create a network");
-
- // Creates structures for input & output.
- std::vector<T> inputData{
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12,
- 1, 2,
- 3, 4,
- 5, 6,
- 7, 8,
- 9, 10,
- 11, 12
- };
-
- std::vector<T> expectedOutput{
- 1, 2,
- 1, 2,
- 3, 4,
- 3, 4,
- 5, 6,
- 5, 6,
- 7, 8,
- 7, 8,
- 9, 10,
- 9, 10,
- 11, 12,
- 11, 12,
- 1, 2,
- 1, 2,
- 3, 4,
- 3, 4,
- 5, 6,
- 5, 6,
- 7, 8,
- 7, 8,
- 9, 10,
- 9, 10,
- 11, 12,
- 11, 12
- };
-
- std::map<int, std::vector<T>> inputTensorData = {{ 0,inputData }, { 1,inputData }};
- std::map<int, std::vector<T>> expectedOutputData = {{ 0,expectedOutput }};
-
- EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
-}
-
-} // anonymous namespace