From e69c399dcee1e75ebf9b2b12f72f3ad628c4e104 Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Mon, 9 Sep 2019 14:31:21 +0100 Subject: IVGCVSW-3824 Implement Float 16 Encoder and Decoder * Implement Float 16 Encoder and Decoder * Add Stack Float 16 layer and create workload tests Signed-off-by: Matthew Jackson Change-Id: Ice4678226f4d22c06ebcc6db3052d42ce0c1bd67 --- src/backends/backendsCommon/common.mk | 1 + src/backends/backendsCommon/test/CMakeLists.txt | 1 + .../test/layerTests/StackTestImpl.cpp | 611 +++++++++++++++++++++ .../test/layerTests/StackTestImpl.hpp | 482 +--------------- 4 files changed, 628 insertions(+), 467 deletions(-) create mode 100644 src/backends/backendsCommon/test/layerTests/StackTestImpl.cpp (limited to 'src/backends/backendsCommon') diff --git a/src/backends/backendsCommon/common.mk b/src/backends/backendsCommon/common.mk index f75870adb7..39e026518f 100644 --- a/src/backends/backendsCommon/common.mk +++ b/src/backends/backendsCommon/common.mk @@ -66,6 +66,7 @@ COMMON_TEST_SOURCES := \ test/layerTests/SpaceToBatchNdTestImpl.cpp \ test/layerTests/SpaceToDepthTestImpl.cpp \ test/layerTests/SplitterTestImpl.cpp \ + test/layerTests/StackTestImpl.cpp \ test/layerTests/StridedSliceTestImpl.cpp \ test/layerTests/SubtractionTestImpl.cpp diff --git a/src/backends/backendsCommon/test/CMakeLists.txt b/src/backends/backendsCommon/test/CMakeLists.txt index 49604b0d3b..e46d48145a 100644 --- a/src/backends/backendsCommon/test/CMakeLists.txt +++ b/src/backends/backendsCommon/test/CMakeLists.txt @@ -113,6 +113,7 @@ list(APPEND armnnBackendsCommonUnitTests_sources layerTests/SpaceToDepthTestImpl.hpp layerTests/SplitterTestImpl.cpp layerTests/SplitterTestImpl.hpp + layerTests/StackTestImpl.cpp layerTests/StackTestImpl.hpp layerTests/StridedSliceTestImpl.cpp layerTests/StridedSliceTestImpl.hpp diff --git a/src/backends/backendsCommon/test/layerTests/StackTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/StackTestImpl.cpp new file mode 100644 index 0000000000..80058c6ea5 --- /dev/null +++ b/src/backends/backendsCommon/test/layerTests/StackTestImpl.cpp @@ -0,0 +1,611 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "StackTestImpl.hpp" +#include "LayerTestResult.hpp" + +#include + +#include + +#include +#include + +#include +#include + +#include + +namespace +{ + +template +LayerTestResult StackTestHelper( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::TensorInfo& inputTensorInfo, + const armnn::TensorInfo& outputTensorInfo, + unsigned int axis, + const std::vector>& inputData, + const std::vector& outputExpectedData) +{ + unsigned int numInputs = static_cast(inputData.size()); + std::vector> inputs; + for (unsigned int i = 0; i < numInputs; ++i) + { + inputs.push_back(MakeTensor(inputTensorInfo, inputData[i])); + } + + LayerTestResult result(outputTensorInfo); + result.outputExpected = MakeTensor(outputTensorInfo, outputExpectedData); + + std::vector> inputHandles; + for (unsigned int i = 0; i < numInputs; ++i) + { + inputHandles.push_back(workloadFactory.CreateTensorHandle(inputTensorInfo)); + } + std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); + + armnn::StackQueueDescriptor descriptor; + descriptor.m_Parameters.m_Axis = axis; + descriptor.m_Parameters.m_InputShape = inputTensorInfo.GetShape(); + descriptor.m_Parameters.m_NumInputs = numInputs; + + armnn::WorkloadInfo info; + for (unsigned int i = 0; i < numInputs; ++i) + { + std::unique_ptr& inputHandle = inputHandles[i]; + AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); + inputHandle->Allocate(); + CopyDataToITensorHandle(inputHandle.get(), inputs[i].origin()); + } + + AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); + outputHandle->Allocate(); + + std::unique_ptr workload = workloadFactory.CreateStack(descriptor, info); + + workload->Execute(); + + CopyDataFromITensorHandle(result.output.origin(), outputHandle.get()); + + return result; +} + +} // anonymous namespace + +// +// Implementation templates +// + +template> +LayerTestResult StackAxis0TestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 2, 3, 2, 3 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + 13, 14, 15, + 16, 17, 18 + }); + + inputData.push_back( + { + 19, 20, 21, + 22, 23, 24, + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36 + }); + + std::vector outputExpectedData = + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + 13, 14, 15, + 16, 17, 18, + + + 19, 20, 21, + 22, 23, 24, + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36 + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 0U, + inputData, + outputExpectedData + ); +} + +template> +LayerTestResult StackOutput4DAxis1TestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + 13, 14, 15, + 16, 17, 18 + }); + + inputData.push_back( + { + 19, 20, 21, + 22, 23, 24, + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36 + }); + + std::vector outputExpectedData = + { + 1, 2, 3, + 4, 5, 6, + + 19, 20, 21, + 22, 23, 24, + + + 7, 8, 9, + 10, 11, 12, + + 25, 26, 27, + 28, 29, 30, + + + 13, 14, 15, + 16, 17, 18, + + 31, 32, 33, + 34, 35, 36 + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 1U, + inputData, + outputExpectedData + ); +} + +template> +LayerTestResult StackOutput4DAxis2TestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + 13, 14, 15, + 16, 17, 18 + }); + + inputData.push_back( + { + 19, 20, 21, + 22, 23, 24, + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36 + }); + + std::vector outputExpectedData = + { + 1, 2, 3, + 19, 20, 21, + + 4, 5, 6, + 22, 23, 24, + + 7, 8, 9, + 25, 26, 27, + + 10, 11, 12, + 28, 29, 30, + + 13, 14, 15, + 31, 32, 33, + + 16, 17, 18, + 34, 35, 36 + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 2U, + inputData, + outputExpectedData + ); +} + +template> +LayerTestResult StackOutput4DAxis3TestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 3, 2, 3, 2 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + 13, 14, 15, + 16, 17, 18 + }); + + inputData.push_back( + { + 19, 20, 21, + 22, 23, 24, + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36 + }); + + std::vector outputExpectedData = + { + 1, 19, + 2, 20, + 3, 21, + + 4, 22, + 5, 23, + 6, 24, + + + 7, 25, + 8, 26, + 9, 27, + + 10, 28, + 11, 29, + 12, 30, + + + 13, 31, + 14, 32, + 15, 33, + + 16, 34, + 17, 35, + 18, 36 + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 3U, + inputData, + outputExpectedData + ); +} + +template> +LayerTestResult StackOutput3DInputs3TestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 3, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 3, 3, 3 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + 7, 8, 9 + }); + + inputData.push_back( + { + 10, 11, 12, + 13, 14, 15, + 16, 17, 18 + }); + + inputData.push_back( + { + 19, 20, 21, + 22, 23, 24, + 25, 26, 27 + }); + + std::vector outputExpectedData = + { + 1, 2, 3, + 10, 11, 12, + 19, 20, 21, + + 4, 5, 6, + 13, 14, 15, + 22, 23, 24, + + 7, 8, 9, + 16, 17, 18, + 25, 26, 27 + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 1U, + inputData, + outputExpectedData + ); +} + +template> +LayerTestResult StackOutput5DTestImpl( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + armnn::TensorInfo inputTensorInfo ({ 2, 2, 2, 3 }, ArmnnType); + armnn::TensorInfo outputTensorInfo({ 2, 2, 2, 2, 3 }, ArmnnType); + + std::vector> inputData; + + inputData.push_back( + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + + 13, 14, 15, + 16, 17, 18, + + 19, 20, 21, + 22, 23, 24 + }); + + inputData.push_back( + { + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36, + + + 37, 38, 39, + 40, 41, 42, + + 43, 44, 45, + 46, 47, 48 + }); + + std::vector outputExpectedData = + { + 1, 2, 3, + 4, 5, 6, + + 7, 8, 9, + 10, 11, 12, + + + 25, 26, 27, + 28, 29, 30, + + 31, 32, 33, + 34, 35, 36, + + + + 13, 14, 15, + 16, 17, 18, + + 19, 20, 21, + 22, 23, 24, + + + 37, 38, 39, + 40, 41, 42, + + 43, 44, 45, + 46, 47, 48 + + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 1U, + inputData, + outputExpectedData + ); +} + +// +// Implementation functions +// + +LayerTestResult StackAxis0Float32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackAxis0TestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackOutput4DAxis1Float32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackOutput4DAxis1TestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackOutput4DAxis2Float32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackOutput4DAxis2TestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackOutput4DAxis3Float32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackOutput4DAxis3TestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackOutput3DInputs3Float32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackOutput3DInputs3TestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackOutput5DFloat32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return StackOutput5DTestImpl(workloadFactory, memoryManager); +} + +LayerTestResult StackFloat16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + using namespace half_float::literal; + + armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, armnn::DataType::Float16); + armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, armnn::DataType::Float16); + + std::vector> inputData; + + inputData.push_back( + { + 1.0_h, 2.0_h, 3.0_h, + 4.0_h, 5.0_h, 6.0_h, + + 7.0_h, 8.0_h, 9.0_h, + 10.0_h, 11.0_h, 12.0_h, + + 13.0_h, 14.0_h, 15.0_h, + 16.0_h, 17.0_h, 18.0_h + }); + + inputData.push_back( + { + 19.0_h, 20.0_h, 21.0_h, + 22.0_h, 23.0_h, 24.0_h, + + 25.0_h, 26.0_h, 27.0_h, + 28.0_h, 29.0_h, 30.0_h, + + 31.0_h, 32.0_h, 33.0_h, + 34.0_h, 35.0_h, 36.0_h + }); + + std::vector outputExpectedData = + { + 1.0_h, 2.0_h, 3.0_h, + 19.0_h, 20.0_h, 21.0_h, + + 4.0_h, 5.0_h, 6.0_h, + 22.0_h, 23.0_h, 24.0_h, + + 7.0_h, 8.0_h, 9.0_h, + 25.0_h, 26.0_h, 27.0_h, + + 10.0_h, 11.0_h, 12.0_h, + 28.0_h, 29.0_h, 30.0_h, + + 13.0_h, 14.0_h, 15.0_h, + 31.0_h, 32.0_h, 33.0_h, + + 16.0_h, 17.0_h, 18.0_h, + 34.0_h, 35.0_h, 36.0_h + }; + + return StackTestHelper( + workloadFactory, + memoryManager, + inputTensorInfo, + outputTensorInfo, + 2U, + inputData, + outputExpectedData + ); +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/StackTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/StackTestImpl.hpp index f063fbb737..a2eb3a12cc 100644 --- a/src/backends/backendsCommon/test/layerTests/StackTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/StackTestImpl.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // @@ -14,482 +14,30 @@ #include #include -#include -#include - -#include - -namespace -{ - -template -LayerTestResult StackTestHelper( +LayerTestResult StackAxis0Float32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - const armnn::TensorInfo& inputTensorInfo, - const armnn::TensorInfo& outputTensorInfo, - unsigned int axis, - const std::vector>& inputData, - const std::vector& outputExpectedData) -{ - unsigned int numInputs = static_cast(inputData.size()); - std::vector> inputs; - for (unsigned int i = 0; i < numInputs; ++i) - { - inputs.push_back(MakeTensor(inputTensorInfo, inputData[i])); - } - - LayerTestResult result(outputTensorInfo); - result.outputExpected = MakeTensor(outputTensorInfo, outputExpectedData); - - std::vector> inputHandles; - for (unsigned int i = 0; i < numInputs; ++i) - { - inputHandles.push_back(workloadFactory.CreateTensorHandle(inputTensorInfo)); - } - std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - - armnn::StackQueueDescriptor descriptor; - descriptor.m_Parameters.m_Axis = axis; - descriptor.m_Parameters.m_InputShape = inputTensorInfo.GetShape(); - descriptor.m_Parameters.m_NumInputs = numInputs; - - armnn::WorkloadInfo info; - for (unsigned int i = 0; i < numInputs; ++i) - { - std::unique_ptr& inputHandle = inputHandles[i]; - AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); - inputHandle->Allocate(); - CopyDataToITensorHandle(inputHandle.get(), inputs[i].origin()); - } + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); - outputHandle->Allocate(); - - std::unique_ptr workload = workloadFactory.CreateStack(descriptor, info); - - workload->Execute(); - - CopyDataFromITensorHandle(result.output.origin(), outputHandle.get()); - - return result; -} - -} // anonymous namespace - -template> -LayerTestResult Stack0AxisTest( +LayerTestResult StackOutput4DAxis1Float32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 2, 3, 2, 3 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - 13, 14, 15, - 16, 17, 18 - }); - - inputData.push_back( - { - 19, 20, 21, - 22, 23, 24, - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36 - }); - - std::vector outputExpectedData = - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - 13, 14, 15, - 16, 17, 18, - - - 19, 20, 21, - 22, 23, 24, - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36 - }; + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 0U, - inputData, - outputExpectedData - ); -} - -template> -LayerTestResult Stack4dOutput1AxisTest( +LayerTestResult StackOutput4DAxis2Float32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - 13, 14, 15, - 16, 17, 18 - }); - - inputData.push_back( - { - 19, 20, 21, - 22, 23, 24, - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36 - }); - - std::vector outputExpectedData = - { - 1, 2, 3, - 4, 5, 6, - - 19, 20, 21, - 22, 23, 24, - - - 7, 8, 9, - 10, 11, 12, - - 25, 26, 27, - 28, 29, 30, - + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - 13, 14, 15, - 16, 17, 18, - - 31, 32, 33, - 34, 35, 36 - }; - - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 1U, - inputData, - outputExpectedData - ); -} - -template> -LayerTestResult Stack4dOutput2AxisTest( +LayerTestResult StackOutput4DAxis3Float32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - 13, 14, 15, - 16, 17, 18 - }); - - inputData.push_back( - { - 19, 20, 21, - 22, 23, 24, - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36 - }); - - std::vector outputExpectedData = - { - 1, 2, 3, - 19, 20, 21, - - 4, 5, 6, - 22, 23, 24, - - 7, 8, 9, - 25, 26, 27, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - 10, 11, 12, - 28, 29, 30, - - 13, 14, 15, - 31, 32, 33, - - 16, 17, 18, - 34, 35, 36 - }; - - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 2U, - inputData, - outputExpectedData - ); -} - -template> -LayerTestResult Stack4dOutput3AxisTest( +LayerTestResult StackOutput3DInputs3Float32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 3, 2, 3, 2 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - 13, 14, 15, - 16, 17, 18 - }); - - inputData.push_back( - { - 19, 20, 21, - 22, 23, 24, - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36 - }); - - std::vector outputExpectedData = - { - 1, 19, - 2, 20, - 3, 21, - - 4, 22, - 5, 23, - 6, 24, - + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - 7, 25, - 8, 26, - 9, 27, - - 10, 28, - 11, 29, - 12, 30, - - - 13, 31, - 14, 32, - 15, 33, - - 16, 34, - 17, 35, - 18, 36 - }; - - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 3U, - inputData, - outputExpectedData - ); -} - -template> -LayerTestResult Stack3dOutput1Axis3InputTest( +LayerTestResult StackOutput5DFloat32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 3, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 3, 3, 3 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - 7, 8, 9 - }); - - inputData.push_back( - { - 10, 11, 12, - 13, 14, 15, - 16, 17, 18 - }); - - inputData.push_back( - { - 19, 20, 21, - 22, 23, 24, - 25, 26, 27 - }); - - std::vector outputExpectedData = - { - 1, 2, 3, - 10, 11, 12, - 19, 20, 21, - - 4, 5, 6, - 13, 14, 15, - 22, 23, 24, - - 7, 8, 9, - 16, 17, 18, - 25, 26, 27 - }; + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 1U, - inputData, - outputExpectedData - ); -} - -template> -LayerTestResult Stack5dOutputTest( +LayerTestResult StackFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) -{ - armnn::TensorInfo inputTensorInfo ({ 2, 2, 2, 3 }, ArmnnType); - armnn::TensorInfo outputTensorInfo({ 2, 2, 2, 2, 3 }, ArmnnType); - - std::vector> inputData; - - inputData.push_back( - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - - 13, 14, 15, - 16, 17, 18, - - 19, 20, 21, - 22, 23, 24 - }); - - inputData.push_back( - { - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36, - - - 37, 38, 39, - 40, 41, 42, - - 43, 44, 45, - 46, 47, 48 - }); - - std::vector outputExpectedData = - { - 1, 2, 3, - 4, 5, 6, - - 7, 8, 9, - 10, 11, 12, - - - 25, 26, 27, - 28, 29, 30, - - 31, 32, 33, - 34, 35, 36, - - - - 13, 14, 15, - 16, 17, 18, - - 19, 20, 21, - 22, 23, 24, - - - 37, 38, 39, - 40, 41, 42, - - 43, 44, 45, - 46, 47, 48 - - }; - - return StackTestHelper( - workloadFactory, - memoryManager, - inputTensorInfo, - outputTensorInfo, - 1U, - inputData, - outputExpectedData - ); -} + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); -- cgit v1.2.1