aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2021-02-17 11:01:00 +0000
committerKeith Davis <keith.davis@arm.com>2021-02-17 12:54:19 +0000
commit8234da468e9739a5bd147fa3fb762318c62fcce6 (patch)
treef61910700a40fa44cd49a9cf34d1ed8c9b3a1caf
parent689c96cc96e0f1181d971d8376b36e8d7088f9ed (diff)
downloadarmnn-8234da468e9739a5bd147fa3fb762318c62fcce6.tar.gz
IVGCVSW-5734 Building armnn failed in our Backends CI job
* CreateTestNetwork() and CreateTransposeTestNetwork should only be defined if Ref enabled; the same as the test its called in otherwise it's defined but not called. Signed-off-by: Francis Murtagh <francis.murtagh@arm.com> Change-Id: I7bc522a7884d216d1a8e51afd7cec7a66e4e2947
-rw-r--r--src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp b/src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
index b47e3c7296..ab990e7c82 100644
--- a/src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
+++ b/src/armnn/test/optimizations/PermuteAndBatchToSpaceAsDepthToSpaceTests.cpp
@@ -19,37 +19,6 @@ namespace
{
/// Shared function for the below tests, so that we test the same network in both cases.
-INetworkPtr CreateTestNetwork()
-{
- // Create a network
- INetworkPtr network = INetwork::Create();
-
- auto input = network->AddInputLayer(0, "input");
- const TensorInfo inputInfo({ 1, 2, 3, 4 }, DataType::Float32);
- input->GetOutputSlot(0).SetTensorInfo(inputInfo);
-
- // Insert Permute which swaps batches and channels dimensions
- auto permute = network->AddPermuteLayer(PermuteDescriptor(PermutationVector{ 3, 1, 2, 0 }), "permute");
- const TensorInfo permuteInfo({ 4, 2, 3, 1 }, DataType::Float32);
- permute->GetOutputSlot(0).SetTensorInfo(permuteInfo);
- input->GetOutputSlot(0).Connect(permute->GetInputSlot(0));
-
- // Insert BatchToSpace
- BatchToSpaceNdDescriptor batchToSpaceDesc;
- batchToSpaceDesc.m_BlockShape = { 2, 2 };
- batchToSpaceDesc.m_DataLayout = DataLayout::NHWC;
- auto batchToSpace = network->AddBatchToSpaceNdLayer(batchToSpaceDesc, "batchToSpace");
- const TensorInfo batchToSpaceInfo({ 1, 4, 6, 1 }, DataType::Float32);
- batchToSpace->GetOutputSlot(0).SetTensorInfo(batchToSpaceInfo);
- permute->GetOutputSlot(0).Connect(batchToSpace->GetInputSlot(0));
-
- auto output = network->AddOutputLayer(0, "output");
- batchToSpace->GetOutputSlot(0).Connect(output->GetInputSlot(0));
-
- return network;
-}
-
-/// Shared function for the below tests, so that we test the same network in both cases.
std::unique_ptr<NetworkImpl> CreateTestNetworkImpl()
{
std::unique_ptr<NetworkImpl> network(new NetworkImpl());
@@ -80,37 +49,6 @@ std::unique_ptr<NetworkImpl> CreateTestNetworkImpl()
}
/// Shared function for the below tests, so that we test the same network in both cases.
-INetworkPtr CreateTransposeTestNetwork()
-{
- // Create a network
- INetworkPtr network = INetwork::Create();
-
- auto input = network->AddInputLayer(0, "input");
- const TensorInfo inputInfo({ 1, 2, 3, 4 }, DataType::Float32);
- input->GetOutputSlot(0).SetTensorInfo(inputInfo);
-
- // Insert Permute which swaps batches and channels dimensions
- auto permute = network->AddTransposeLayer(TransposeDescriptor(PermutationVector{ 3, 1, 2, 0 }), "permute");
- const TensorInfo permuteInfo({ 4, 2, 3, 1 }, DataType::Float32);
- permute->GetOutputSlot(0).SetTensorInfo(permuteInfo);
- input->GetOutputSlot(0).Connect(permute->GetInputSlot(0));
-
- // Insert BatchToSpace
- BatchToSpaceNdDescriptor batchToSpaceDesc;
- batchToSpaceDesc.m_BlockShape = { 2, 2 };
- batchToSpaceDesc.m_DataLayout = DataLayout::NHWC;
- auto batchToSpace = network->AddBatchToSpaceNdLayer(batchToSpaceDesc, "batchToSpace");
- const TensorInfo batchToSpaceInfo({ 1, 4, 6, 1 }, DataType::Float32);
- batchToSpace->GetOutputSlot(0).SetTensorInfo(batchToSpaceInfo);
- permute->GetOutputSlot(0).Connect(batchToSpace->GetInputSlot(0));
-
- auto output = network->AddOutputLayer(0, "output");
- batchToSpace->GetOutputSlot(0).Connect(output->GetInputSlot(0));
-
- return network;
-}
-
-/// Shared function for the below tests, so that we test the same network in both cases.
std::unique_ptr<NetworkImpl> CreateTransposeTestNetworkImpl()
{
// Create a network
@@ -206,6 +144,68 @@ BOOST_AUTO_TEST_CASE(TransposeAndBatchToSpaceAsDepthToSpaceOptimizerTest)
// This unit test needs the reference backend, it's not available if the reference backend is not built
#if defined(ARMNNREF_ENABLED)
+/// Shared function for the below tests, so that we test the same network in both cases.
+INetworkPtr CreateTestNetwork()
+{
+ // Create a network
+ INetworkPtr network = INetwork::Create();
+
+ auto input = network->AddInputLayer(0, "input");
+ const TensorInfo inputInfo({ 1, 2, 3, 4 }, DataType::Float32);
+ input->GetOutputSlot(0).SetTensorInfo(inputInfo);
+
+ // Insert Permute which swaps batches and channels dimensions
+ auto permute = network->AddPermuteLayer(PermuteDescriptor(PermutationVector{ 3, 1, 2, 0 }), "permute");
+ const TensorInfo permuteInfo({ 4, 2, 3, 1 }, DataType::Float32);
+ permute->GetOutputSlot(0).SetTensorInfo(permuteInfo);
+ input->GetOutputSlot(0).Connect(permute->GetInputSlot(0));
+
+ // Insert BatchToSpace
+ BatchToSpaceNdDescriptor batchToSpaceDesc;
+ batchToSpaceDesc.m_BlockShape = { 2, 2 };
+ batchToSpaceDesc.m_DataLayout = DataLayout::NHWC;
+ auto batchToSpace = network->AddBatchToSpaceNdLayer(batchToSpaceDesc, "batchToSpace");
+ const TensorInfo batchToSpaceInfo({ 1, 4, 6, 1 }, DataType::Float32);
+ batchToSpace->GetOutputSlot(0).SetTensorInfo(batchToSpaceInfo);
+ permute->GetOutputSlot(0).Connect(batchToSpace->GetInputSlot(0));
+
+ auto output = network->AddOutputLayer(0, "output");
+ batchToSpace->GetOutputSlot(0).Connect(output->GetInputSlot(0));
+
+ return network;
+}
+
+/// Shared function for the below tests, so that we test the same network in both cases.
+INetworkPtr CreateTransposeTestNetwork()
+{
+ // Create a network
+ INetworkPtr network = INetwork::Create();
+
+ auto input = network->AddInputLayer(0, "input");
+ const TensorInfo inputInfo({ 1, 2, 3, 4 }, DataType::Float32);
+ input->GetOutputSlot(0).SetTensorInfo(inputInfo);
+
+ // Insert Permute which swaps batches and channels dimensions
+ auto permute = network->AddTransposeLayer(TransposeDescriptor(PermutationVector{ 3, 1, 2, 0 }), "permute");
+ const TensorInfo permuteInfo({ 4, 2, 3, 1 }, DataType::Float32);
+ permute->GetOutputSlot(0).SetTensorInfo(permuteInfo);
+ input->GetOutputSlot(0).Connect(permute->GetInputSlot(0));
+
+ // Insert BatchToSpace
+ BatchToSpaceNdDescriptor batchToSpaceDesc;
+ batchToSpaceDesc.m_BlockShape = { 2, 2 };
+ batchToSpaceDesc.m_DataLayout = DataLayout::NHWC;
+ auto batchToSpace = network->AddBatchToSpaceNdLayer(batchToSpaceDesc, "batchToSpace");
+ const TensorInfo batchToSpaceInfo({ 1, 4, 6, 1 }, DataType::Float32);
+ batchToSpace->GetOutputSlot(0).SetTensorInfo(batchToSpaceInfo);
+ permute->GetOutputSlot(0).Connect(batchToSpace->GetInputSlot(0));
+
+ auto output = network->AddOutputLayer(0, "output");
+ batchToSpace->GetOutputSlot(0).Connect(output->GetInputSlot(0));
+
+ return network;
+}
+
/// Tests that a optimization performed by PermuteAndBatchToSpaceAsDepthToSpace does not change the behaviour
/// of the network (i.e. it still produces the correct output).
BOOST_AUTO_TEST_CASE(PermuteAndBatchToSpaceAsDepthToSpaceCorrectnessTest)