diff options
author | Keith Davis <keith.davis@arm.com> | 2020-08-27 15:38:12 +0100 |
---|---|---|
committer | KeithARM <keith.davis@arm.com> | 2020-08-31 16:05:39 +0000 |
commit | 33a626f14c8db13967ba2a933388223d5bf733c3 (patch) | |
tree | 109319777c0f638be639d7d723a417abe97d843c /src/backends/backendsCommon/test/layerTests | |
parent | 826a543547f325bfac7da507d19a55af9c138a50 (diff) | |
download | armnn-33a626f14c8db13967ba2a933388223d5bf733c3.tar.gz |
IVGCVSW-5231 Remove CreateTensorHandle in the test where there is NO_DEPRECATE_WARN
* Done for all elementwise layers, Activation, BatchNorm, BatchToSpace
Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: Id1d15a0960233026aecf7a07e0d3f006e07e4abf
Diffstat (limited to 'src/backends/backendsCommon/test/layerTests')
30 files changed, 1119 insertions, 611 deletions
diff --git a/src/backends/backendsCommon/test/layerTests/AbsTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/AbsTestImpl.cpp index 2cbc059044..8650f94b1a 100644 --- a/src/backends/backendsCommon/test/layerTests/AbsTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/AbsTestImpl.cpp @@ -10,7 +10,8 @@ template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> Abs2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 2, 2 }; @@ -35,13 +36,15 @@ LayerTestResult<T, 2> Abs2dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 3> Abs3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 3, 1, 2 }; @@ -65,13 +68,15 @@ LayerTestResult<T, 3> Abs3dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> AbsZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -92,7 +97,8 @@ LayerTestResult<T, 2> AbsZeroTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } // @@ -102,74 +108,89 @@ LayerTestResult<T, 2> AbsZeroTest( template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> Abs2dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 2> Abs2dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Signed32>, 2> Abs2dTest<armnn::DataType::Signed32>( armnn::IWorkloadFactory& workloadFactory, -const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 2> Abs2dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 2> Abs2dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 2> Abs2dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 3> Abs3dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 3> Abs3dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 3> Abs3dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Signed32>, 3> Abs3dTest<armnn::DataType::Signed32>( armnn::IWorkloadFactory& workloadFactory, -const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 3> Abs3dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 3> Abs3dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> AbsZeroTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 2> AbsZeroTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Signed32>, 2> AbsZeroTest<armnn::DataType::Signed32>( armnn::IWorkloadFactory& workloadFactory, -const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/AbsTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/AbsTestImpl.hpp index d0f775e21e..44dd9cea9d 100644 --- a/src/backends/backendsCommon/test/layerTests/AbsTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/AbsTestImpl.hpp @@ -15,14 +15,17 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> Abs2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 3> Abs3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> AbsZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp index 5be8c22648..543ea7716a 100644 --- a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp @@ -8,10 +8,10 @@ #include <QuantizeHelper.hpp> #include <ResolveType.hpp> - #include <backendsCommon/test/ActivationFixture.hpp> #include <backendsCommon/test/TensorCopyUtils.hpp> #include <backendsCommon/test/WorkloadTestUtils.hpp> +#include <reference/test/RefWorkloadFactoryHelper.hpp> #include <test/TensorHelpers.hpp> @@ -23,6 +23,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BoundedReLuTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float upperBound, float lowerBound, float inputScale, @@ -59,10 +60,8 @@ LayerTestResult<T, 4> BoundedReLuTestCommon( auto input = MakeTensor<T, 4>(inputTensorInfo, inputData); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); // Setup bounded ReLu. armnn::ActivationQueueDescriptor descriptor; @@ -92,7 +91,8 @@ LayerTestResult<T, 4> BoundedReLuTestCommon( LayerTestResult<float, 4> BoundedReLuUpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int inputWidth = 4u; unsigned int inputHeight = 5u; @@ -117,13 +117,14 @@ LayerTestResult<float, 4> BoundedReLuUpperAndLowerBoundTest( }; return BoundedReLuTestCommon<armnn::DataType::Float32>( - workloadFactory, memoryManager, 1.0f, -1.0f, 1.0f, 0, 1.0f, 0, input, output, + workloadFactory, memoryManager, tensorHandleFactory, 1.0f, -1.0f, 1.0f, 0, 1.0f, 0, input, output, inputWidth, inputHeight, inputChannels, inputBatchSize); } LayerTestResult<float, 4> BoundedReLuUpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int inputWidth = 4u; unsigned int inputHeight = 5u; @@ -148,13 +149,14 @@ LayerTestResult<float, 4> BoundedReLuUpperBoundOnlyTest( }; return BoundedReLuTestCommon<armnn::DataType::Float32>( - workloadFactory, memoryManager, 6.0f, 0.0f, 1.0f, 0, 1.0f, 0, input, output, + workloadFactory, memoryManager, tensorHandleFactory, 6.0f, 0.0f, 1.0f, 0, 1.0f, 0, input, output, inputWidth, inputHeight, inputChannels, inputBatchSize); } LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int inputWidth = 3u; unsigned int inputHeight = 2u; @@ -178,14 +180,15 @@ LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperBoundOnlyTest( int32_t outputOffset = 0; return BoundedReLuTestCommon<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, 6.0f, 0.0f, + workloadFactory, memoryManager, tensorHandleFactory, 6.0f, 0.0f, inputScale, inputOffset, outputScale, outputOffset, input, output, inputWidth, inputHeight, inputChannels, inputBatchSize); } LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int inputWidth = 3u; unsigned int inputHeight = 2u; @@ -207,7 +210,7 @@ LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperAndLowerBoundTest( float inputScale = 0.0125f; return BoundedReLuTestCommon<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, 1.0f, -1.0f, + workloadFactory, memoryManager, tensorHandleFactory, 1.0f, -1.0f, inputScale, inputOffset, inputScale, inputOffset, // Input/output scale & offset same. input, output, inputWidth, inputHeight, inputChannels, inputBatchSize); } @@ -243,6 +246,7 @@ struct BoundedReLuRandomInputTestTraits boost::multi_array<float, 4> BoundedReLuRandomInputTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float lowerBound, float upperBound, const armnn::ActivationDescriptor& activationDescriptor) @@ -257,10 +261,8 @@ boost::multi_array<float, 4> BoundedReLuRandomInputTest( // range [lowerBound, upperBound]. auto input = MakeRandomTensor<float, 4>(inputTensorInfo, 4605828, lowerBound - 5.0f, upperBound * 2.0f); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); // Set up bounded ReLu. armnn::ActivationQueueDescriptor descriptor; @@ -289,6 +291,8 @@ LayerTestResult<float, 4> CompareBoundedReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, float upperBound, float lowerBound) { @@ -300,9 +304,9 @@ LayerTestResult<float, 4> CompareBoundedReLuTest( activationDescriptor.m_B = lowerBound; result.output = BoundedReLuRandomInputTest( - workloadFactory, memoryManager, 0.0f, upperBound, activationDescriptor); + workloadFactory, memoryManager, tensorHandleFactory, 0.0f, upperBound, activationDescriptor); result.outputExpected = BoundedReLuRandomInputTest( - refWorkloadFactory, nullptr, 0.0f, upperBound, activationDescriptor); + refWorkloadFactory, nullptr, refTensorHandleFactory, 0.0f, upperBound, activationDescriptor); return result; } @@ -311,6 +315,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T,4> ConstantLinearActivationTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale = 0.0f, int32_t qOffset = 0) { @@ -338,10 +343,8 @@ LayerTestResult<T,4> ConstantLinearActivationTestCommon( } LayerTestResult<T, 4> ret(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); // Do linear activation that should leave the tensor unchanged. armnn::ActivationQueueDescriptor data; @@ -372,31 +375,37 @@ LayerTestResult<T,4> ConstantLinearActivationTestCommon( LayerTestResult<float, 4> ConstantLinearActivationTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return ConstantLinearActivationTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager); + return ConstantLinearActivationTestCommon<armnn::DataType::Float32>(workloadFactory, + memoryManager, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> ConstantLinearActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return ConstantLinearActivationTestCommon<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, 4.0f, 3); + workloadFactory, memoryManager, tensorHandleFactory, 4.0f, 3); } LayerTestResult<int16_t, 4> ConstantLinearActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return ConstantLinearActivationTestCommon<armnn::DataType::QSymmS16>( - workloadFactory, memoryManager, 0.1f, 0); + workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> SimpleActivationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, armnn::ActivationFunction activationFunction, float activationParameterA, float activationParameterB, @@ -434,10 +443,8 @@ LayerTestResult<T, 4> SimpleActivationTest( auto input = MakeTensor<T, 4>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, scale, offset)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); // Setup bounded ReLu. armnn::ActivationQueueDescriptor descriptor; @@ -471,6 +478,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> SimpleSigmoidTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -492,6 +500,7 @@ LayerTestResult<T, 4> SimpleSigmoidTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::Sigmoid, 0.f, 0.f, @@ -505,29 +514,36 @@ LayerTestResult<T, 4> SimpleSigmoidTestCommon( LayerTestResult<float, 4> SimpleSigmoidTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SimpleSigmoidTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0); + return SimpleSigmoidTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, + tensorHandleFactory, 0.0f, 0); } LayerTestResult<uint8_t, 4> SimpleSigmoidUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SimpleSigmoidTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 50); + return SimpleSigmoidTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, + tensorHandleFactory, 0.1f, 50); } LayerTestResult<int16_t, 4> SimpleSigmoidInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SimpleSigmoidTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return SimpleSigmoidTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, + tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> ReLuTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -548,6 +564,7 @@ LayerTestResult<T, 4> ReLuTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::ReLu, 0.f, 0.f, @@ -561,24 +578,27 @@ LayerTestResult<T, 4> ReLuTestCommon( LayerTestResult<int16_t, 4> ReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> ReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return ReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 0); + return ReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<float, 4> ReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return ReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return ReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } @@ -586,6 +606,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BoundedReLuTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -607,6 +628,7 @@ LayerTestResult<T, 4> BoundedReLuTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::BoundedReLu, a, b, @@ -620,9 +642,10 @@ LayerTestResult<T, 4> BoundedReLuTestCommon( LayerTestResult<int16_t, 4> BoundedReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return ReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } @@ -631,6 +654,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> SoftReLuTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -651,6 +675,7 @@ LayerTestResult<T, 4> SoftReLuTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::SoftReLu, 0.f, 0.f, @@ -664,29 +689,34 @@ LayerTestResult<T, 4> SoftReLuTestCommon( LayerTestResult<float, 4> SoftReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SoftReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return SoftReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> SoftReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SoftReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64); + return SoftReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, + tensorHandleFactory, 0.0625f, 64); } LayerTestResult<int16_t, 4> SoftReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SoftReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return SoftReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> LeakyReLuTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -708,6 +738,7 @@ LayerTestResult<T, 4> LeakyReLuTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::LeakyReLu, a, 0.f, @@ -721,29 +752,34 @@ LayerTestResult<T, 4> LeakyReLuTestCommon( LayerTestResult<float, 4> LeakyReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return LeakyReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return LeakyReLuTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> LeakyReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return LeakyReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64); + return LeakyReLuTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, + tensorHandleFactory, 0.0625f, 64); } LayerTestResult<int16_t, 4> LeakyReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return LeakyReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return LeakyReLuTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> AbsTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -764,6 +800,7 @@ LayerTestResult<T, 4> AbsTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::Abs, 0.f, 0.f, @@ -777,28 +814,32 @@ LayerTestResult<T, 4> AbsTestCommon( LayerTestResult<float, 4> AbsTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return AbsTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return AbsTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> AbsUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return AbsTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64); + return AbsTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.0625f, 64); } LayerTestResult<int16_t, 4> AbsInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return AbsTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return AbsTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<float, 5> SqrtNNTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); const int inputDataSize = 120; @@ -825,10 +866,8 @@ LayerTestResult<float, 5> SqrtNNTest( auto input = MakeTensor<float, 5>(inputTensorInfo, inputData); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::ActivationQueueDescriptor descriptor; armnn::WorkloadInfo workloadInfo; @@ -858,6 +897,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> SqrtTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -878,6 +918,7 @@ LayerTestResult<T, 4> SqrtTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::Sqrt, 0.f, 0.f, @@ -891,29 +932,33 @@ LayerTestResult<T, 4> SqrtTestCommon( LayerTestResult<float, 4> SqrtTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SqrtTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return SqrtTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> SqrtUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SqrtTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64); + return SqrtTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.0625f, 64); } LayerTestResult<int16_t, 4> SqrtInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SqrtTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return SqrtTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> SquareTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -934,6 +979,7 @@ LayerTestResult<T, 4> SquareTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::Square, 0.f, 0.f, @@ -947,29 +993,34 @@ LayerTestResult<T, 4> SquareTestCommon( LayerTestResult<float, 4> SquareTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SquareTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return SquareTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> SquareUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SquareTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.0625f, 64); + return SquareTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, + tensorHandleFactory, 0.0625f, 64); } LayerTestResult<int16_t, 4> SquareInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return SquareTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return SquareTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> TanhTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -992,6 +1043,7 @@ LayerTestResult<T, 4> TanhTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::TanH, a, b, @@ -1005,23 +1057,26 @@ LayerTestResult<T, 4> TanhTestCommon( LayerTestResult<float, 4> TanhTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return TanhTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return TanhTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> TanhUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return TanhTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 64); + return TanhTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); } LayerTestResult<int16_t, 4> TanhInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return TanhTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return TanhTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } @@ -1029,6 +1084,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> EluTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -1051,6 +1107,7 @@ LayerTestResult<T, 4> EluTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::Elu, a, 0.0f, @@ -1064,23 +1121,26 @@ LayerTestResult<T, 4> EluTestCommon( LayerTestResult<float, 4> EluTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return EluTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return EluTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> EluUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return EluTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 64); + return EluTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 64); } LayerTestResult<int16_t, 4> EluInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return EluTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return EluTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } @@ -1088,6 +1148,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> HardSwishTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -1114,6 +1175,7 @@ LayerTestResult<T, 4> HardSwishTestCommon( return SimpleActivationTest<ArmnnType>(workloadFactory, memoryManager, + tensorHandleFactory, armnn::ActivationFunction::HardSwish, 0.f, 0.f, @@ -1127,23 +1189,27 @@ LayerTestResult<T, 4> HardSwishTestCommon( LayerTestResult<float, 4> HardSwishTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return HardSwishTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.1f, 0); + return HardSwishTestCommon<armnn::DataType::Float32>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } LayerTestResult<uint8_t, 4> HardSwishUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return HardSwishTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, 0.1f, 64); + return HardSwishTestCommon<armnn::DataType::QAsymmU8>(workloadFactory, memoryManager, + tensorHandleFactory, 0.1f, 64); } LayerTestResult<int16_t, 4> HardSwishInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { - return HardSwishTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, 0.1f, 0); + return HardSwishTestCommon<armnn::DataType::QSymmS16>(workloadFactory, memoryManager, tensorHandleFactory, 0.1f, 0); } @@ -1152,6 +1218,8 @@ LayerTestResult<T,4> CompareActivationTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f, unsigned int batchSize = 5, float qScale = 0.0f, @@ -1200,13 +1268,11 @@ LayerTestResult<T,4> CompareActivationTestImpl( ret.output.resize(boostArrayExtents); ret.outputExpected.resize(boostArrayExtents); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> inputHandleRef = refWorkloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refWorkloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandleRef = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refTensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::ActivationQueueDescriptor data; armnn::WorkloadInfo info; @@ -1247,29 +1313,38 @@ LayerTestResult<float,4> CompareActivationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f, unsigned int batchSize) { return CompareActivationTestImpl<armnn::DataType::Float32>( - workloadFactory, memoryManager, refWorkloadFactory, f, batchSize); + workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, + refTensorHandleFactory, f, batchSize); } LayerTestResult<uint8_t,4> CompareActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f) { return CompareActivationTestImpl<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, refWorkloadFactory, f, 5, 0.1f, 50); + workloadFactory, memoryManager, refWorkloadFactory, + tensorHandleFactory, refTensorHandleFactory, f, 5, 0.1f, 50); } LayerTestResult<int16_t,4> CompareActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f) { return CompareActivationTestImpl<armnn::DataType::QSymmS16>( - workloadFactory, memoryManager, refWorkloadFactory, f, 5, 0.1f, 0); + workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, + refTensorHandleFactory, f, 5, 0.1f, 0); } diff --git a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.hpp index 2bd517180f..a65d97cdce 100644 --- a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.hpp @@ -16,15 +16,18 @@ LayerTestResult<float, 4> SimpleSigmoidTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SimpleSigmoidUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SimpleSigmoidInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // TanH @@ -32,15 +35,18 @@ LayerTestResult<int16_t, 4> SimpleSigmoidInt16Test( LayerTestResult<float, 4> TanhTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> TanhUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> TanhInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Linear @@ -48,15 +54,18 @@ LayerTestResult<int16_t, 4> TanhInt16Test( LayerTestResult<float, 4> ConstantLinearActivationTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> ConstantLinearActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> ConstantLinearActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // ReLu @@ -64,15 +73,18 @@ LayerTestResult<int16_t, 4> ConstantLinearActivationInt16Test( LayerTestResult<float, 4> ReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> ReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> ReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // BoundedReLu @@ -91,28 +103,35 @@ LayerTestResult<uint8_t, 4> BoundedReLuUint8Test( LayerTestResult<int16_t, 4> BoundedReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> BoundedReLuUpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactor, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManagery); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManagery, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> BoundedReLuUpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> BoundedReLuUint8UpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> CompareBoundedReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, float upperBound, float lowerBound); @@ -122,15 +141,18 @@ LayerTestResult<float, 4> CompareBoundedReLuTest( LayerTestResult<float, 4> SoftReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SoftReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SoftReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // LeakyReLu @@ -138,15 +160,18 @@ LayerTestResult<int16_t, 4> SoftReLuInt16Test( LayerTestResult<float, 4> LeakyReLuTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> LeakyReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> LeakyReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Elu @@ -154,15 +179,18 @@ LayerTestResult<int16_t, 4> LeakyReLuInt16Test( LayerTestResult<float, 4> EluTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> EluUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> EluInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Abs @@ -170,15 +198,18 @@ LayerTestResult<int16_t, 4> EluInt16Test( LayerTestResult<float, 4> AbsTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> AbsUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> AbsInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Sqrt @@ -186,19 +217,23 @@ LayerTestResult<int16_t, 4> AbsInt16Test( LayerTestResult<float, 4> SqrtTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 5> SqrtNNTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SqrtUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SqrtInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Square @@ -206,15 +241,18 @@ LayerTestResult<int16_t, 4> SqrtInt16Test( LayerTestResult<float, 4> SquareTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SquareUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SquareInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // HardSwish @@ -222,15 +260,18 @@ LayerTestResult<int16_t, 4> SquareInt16Test( LayerTestResult<float, 4> HardSwishTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> HardSwishUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> HardSwishInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); // // Other @@ -240,6 +281,8 @@ LayerTestResult<float, 4> CompareActivationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f, unsigned int batchSize); @@ -247,10 +290,14 @@ LayerTestResult<uint8_t, 4> CompareActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f); LayerTestResult<int16_t, 4> CompareActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory, armnn::ActivationFunction f); diff --git a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp index c0a2ca8faf..0e1b7336de 100644 --- a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp @@ -8,6 +8,7 @@ #include "ElementwiseTestImpl.hpp" #include <QuantizeHelper.hpp> +#include <reference/test/RefWorkloadFactoryHelper.hpp> template<> std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::AdditionQueueDescriptor>( @@ -20,7 +21,8 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::AdditionQueueDescriptor> LayerTestResult<float,4> AdditionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int batchSize = 2u; unsigned int channels = 2u; @@ -83,12 +85,14 @@ LayerTestResult<float,4> AdditionTest( shape, input2, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 5> Addition5dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int depth = 2u; unsigned int batchSize = 2u; @@ -155,7 +159,8 @@ LayerTestResult<float, 5> Addition5dTest( shape, input2, shape, - output); + output, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> @@ -163,7 +168,8 @@ LayerTestResult<T, 4> AdditionBroadcastTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float qScale, - int32_t qOffset) + int32_t qOffset, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); armnn::TensorInfo inputTensorInfo1 = armnn::TensorInfo({1, 3, 2, 1}, ArmnnType); @@ -214,11 +220,9 @@ LayerTestResult<T, 4> AdditionBroadcastTestImpl( }, qScale, qOffset)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> inputHandle2 = workloadFactory.CreateTensorHandle(inputTensorInfo2); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle1 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> inputHandle2 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo2); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::AdditionQueueDescriptor data; armnn::WorkloadInfo info; @@ -248,7 +252,8 @@ LayerTestResult<T, 4> AdditionBroadcast1ElementTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float qScale, - int32_t qOffset) + int32_t qOffset, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); armnn::TensorInfo inputTensorInfo1 = armnn::TensorInfo({1, 3, 2, 3}, ArmnnType); @@ -294,11 +299,9 @@ LayerTestResult<T, 4> AdditionBroadcast1ElementTestImpl( }, qScale, qOffset)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> inputHandle2 = workloadFactory.CreateTensorHandle(inputTensorInfo2); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle1 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> inputHandle2 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo2); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::AdditionQueueDescriptor data; armnn::WorkloadInfo info; @@ -325,71 +328,80 @@ LayerTestResult<T, 4> AdditionBroadcast1ElementTestImpl( LayerTestResult<float, 4> AdditionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcastTestImpl<armnn::DataType::Float32>( - workloadFactory, memoryManager, 0.0f, 0); + workloadFactory, memoryManager, 0.0f, 0, tensorHandleFactory); } LayerTestResult<uint8_t, 4> AdditionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcastTestImpl<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, 2.f, 0); + workloadFactory, memoryManager, 2.f, 0, tensorHandleFactory); } LayerTestResult<int16_t, 4> AdditionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcastTestImpl<armnn::DataType::QSymmS16>( - workloadFactory, memoryManager, 2.f, 0); + workloadFactory, memoryManager, 2.f, 0, tensorHandleFactory); } LayerTestResult<int32_t, 4> AdditionBroadcastInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcastTestImpl<armnn::DataType::Signed32>( - workloadFactory, memoryManager, 1.f, 0); + workloadFactory, memoryManager, 1.f, 0, tensorHandleFactory); } LayerTestResult<float, 4> AdditionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcast1ElementTestImpl<armnn::DataType::Float32>( - workloadFactory, memoryManager, 0.0f, 0); + workloadFactory, memoryManager, 0.0f, 0, tensorHandleFactory); } LayerTestResult<uint8_t, 4> AdditionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcast1ElementTestImpl<armnn::DataType::QAsymmU8>( - workloadFactory, memoryManager, 0.1333333f, 128); + workloadFactory, memoryManager, 0.1333333f, 128, tensorHandleFactory); } LayerTestResult<int16_t, 4> AdditionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcast1ElementTestImpl<armnn::DataType::QSymmS16>( - workloadFactory, memoryManager, 0.1333333f, 0); + workloadFactory, memoryManager, 0.1333333f, 0, tensorHandleFactory); } LayerTestResult<int32_t, 4> AdditionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { return AdditionBroadcast1ElementTestImpl<armnn::DataType::Signed32>( - workloadFactory, memoryManager, 1.f, 0); + workloadFactory, memoryManager, 1.f, 0, tensorHandleFactory); } LayerTestResult<uint8_t, 4> AdditionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 2, 2, 3 }; @@ -425,13 +437,15 @@ LayerTestResult<uint8_t, 4> AdditionUint8Test( 3, shape0, output, + tensorHandleFactory, 7.0f, 3); } LayerTestResult<int16_t, 4> AdditionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 2, 2, 3 }; @@ -467,13 +481,15 @@ LayerTestResult<int16_t, 4> AdditionInt16Test( 0, shape0, output, + tensorHandleFactory, 7.0f, 0); } LayerTestResult<int32_t, 4> AdditionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 2, 2, 3 }; @@ -509,13 +525,15 @@ LayerTestResult<int32_t, 4> AdditionInt32Test( 0, shape0, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<float, 4> AdditionAfterMaxPoolTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); @@ -532,12 +550,10 @@ LayerTestResult<float, 4> AdditionAfterMaxPoolTest( 4, 5, 6, 7, 8, 9 }); - ARMNN_NO_DEPRECATE_WARN_BEGIN std::unique_ptr<armnn::ITensorHandle> poolingInputHandle = - workloadFactory.CreateTensorHandle(poolingInputTensorInfo); + tensorHandleFactory.CreateTensorHandle(poolingInputTensorInfo); std::unique_ptr<armnn::ITensorHandle> poolingOutputHandle = - workloadFactory.CreateTensorHandle(poolingOutputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + tensorHandleFactory.CreateTensorHandle(poolingOutputTensorInfo); // Apply MaxPool poolSize = 1x1, stride=2x2 // Result = @@ -587,10 +603,9 @@ LayerTestResult<float, 4> AdditionAfterMaxPoolTest( 31, 37 })); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> addInputHandle = workloadFactory.CreateTensorHandle(addInputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> addOutputHandle = workloadFactory.CreateTensorHandle(addOutputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> addInputHandle = tensorHandleFactory.CreateTensorHandle(addInputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> addOutputHandle = + tensorHandleFactory.CreateTensorHandle(addOutputTensorInfo); armnn::AdditionQueueDescriptor data; armnn::WorkloadInfo info; @@ -626,7 +641,9 @@ LayerTestResult<float, 4> AdditionAfterMaxPoolTest( LayerTestResult<float,4> CompareAdditionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory) + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory) { IgnoreUnused(memoryManager); unsigned int batchSize = 4; @@ -648,15 +665,13 @@ LayerTestResult<float,4> CompareAdditionTest( LayerTestResult<float,4> ret(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> inputHandle2 = workloadFactory.CreateTensorHandle(inputTensorInfo2); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> inputHandle1 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> inputHandle2 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo2); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> inputHandle1Ref = refWorkloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> inputHandle2Ref = refWorkloadFactory.CreateTensorHandle(inputTensorInfo2); - std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refWorkloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle1Ref = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> inputHandle2Ref = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo2); + std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refTensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::AdditionQueueDescriptor data; armnn::WorkloadInfo info; diff --git a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp index 8c5385f527..b6d6e4ad43 100644 --- a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp @@ -12,61 +12,77 @@ LayerTestResult<float, 4> AdditionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 5> Addition5dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> AdditionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> AdditionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> AdditionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> AdditionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> AdditionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> AdditionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> AdditionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> AdditionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> AdditionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> AdditionBroadcastInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> AdditionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> AdditionAfterMaxPoolTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> CompareAdditionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory); + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/ArgMinMaxTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/ArgMinMaxTestImpl.hpp index 47c34a7a9b..2e7a54b6af 100644 --- a/src/backends/backendsCommon/test/layerTests/ArgMinMaxTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/ArgMinMaxTestImpl.hpp @@ -11,7 +11,6 @@ #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> -#include <backendsCommon/test/WorkloadFactoryHelper.hpp> template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<int32_t, 3> ArgMaxSimpleTest(armnn::IWorkloadFactory& workloadFactory, diff --git a/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.cpp index 44cfc69c24..eb4f461eb9 100644 --- a/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.cpp @@ -14,6 +14,7 @@ #include <backendsCommon/CpuTensorHandle.hpp> #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> +#include <reference/test/RefWorkloadFactoryHelper.hpp> #include <backendsCommon/test/TensorCopyUtils.hpp> #include <backendsCommon/test/WorkloadTestUtils.hpp> @@ -29,6 +30,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchNormTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, const armnn::TensorShape& inputOutputTensorShape, const std::vector<float>& inputValues, const std::vector<float>& expectedOutputValues, @@ -69,10 +71,8 @@ LayerTestResult<T, 4> BatchNormTestImpl( result.outputExpected = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(expectedOutputValues, qScale, qOffset)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::ScopedCpuTensorHandle meanTensor(tensorInfo); armnn::ScopedCpuTensorHandle varianceTensor(tensorInfo); @@ -114,6 +114,7 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T,4> BatchNormTestNhwcImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, float qScale, int32_t qOffset) { @@ -154,10 +155,8 @@ LayerTestResult<T,4> BatchNormTestNhwcImpl( auto gamma = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 2, 1 }, qScale, qOffset)); LayerTestResult<T,4> ret(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::BatchNormalizationQueueDescriptor data; armnn::WorkloadInfo info; @@ -210,7 +209,8 @@ LayerTestResult<T,4> BatchNormTestNhwcImpl( LayerTestResult<float, 4> BatchNormFloat32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Channels: 2 @@ -246,6 +246,7 @@ LayerTestResult<float, 4> BatchNormFloat32Test( return BatchNormTestImpl<armnn::DataType::Float32>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -256,7 +257,8 @@ LayerTestResult<float, 4> BatchNormFloat32Test( LayerTestResult<float, 4> BatchNormFloat32NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Height: 3 @@ -296,6 +298,7 @@ LayerTestResult<float, 4> BatchNormFloat32NhwcTest( return BatchNormTestImpl<armnn::DataType::Float32>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -306,7 +309,8 @@ LayerTestResult<float, 4> BatchNormFloat32NhwcTest( LayerTestResult<armnn::Half, 4> BatchNormFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Channels: 2 @@ -342,6 +346,7 @@ LayerTestResult<armnn::Half, 4> BatchNormFloat16Test( return BatchNormTestImpl<armnn::DataType::Float16>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -352,7 +357,8 @@ LayerTestResult<armnn::Half, 4> BatchNormFloat16Test( LayerTestResult<armnn::Half, 4> BatchNormFloat16NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Height: 3 @@ -392,6 +398,7 @@ LayerTestResult<armnn::Half, 4> BatchNormFloat16NhwcTest( return BatchNormTestImpl<armnn::DataType::Float16>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -402,7 +409,8 @@ LayerTestResult<armnn::Half, 4> BatchNormFloat16NhwcTest( LayerTestResult<uint8_t, 4> BatchNormUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Channels: 2 @@ -438,6 +446,7 @@ LayerTestResult<uint8_t, 4> BatchNormUint8Test( return BatchNormTestImpl<armnn::DataType::QAsymmU8>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -448,7 +457,8 @@ LayerTestResult<uint8_t, 4> BatchNormUint8Test( LayerTestResult<uint8_t, 4> BatchNormUint8NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Height: 3 @@ -488,13 +498,15 @@ LayerTestResult<uint8_t, 4> BatchNormUint8NhwcTest( return BatchNormTestImpl<armnn::DataType::QAsymmU8>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, 1.f/20.f, 50, armnn::DataLayout::NHWC); } LayerTestResult<int16_t, 4> BatchNormInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Channels: 2 @@ -530,6 +542,7 @@ LayerTestResult<int16_t, 4> BatchNormInt16Test( return BatchNormTestImpl<armnn::DataType::QSymmS16>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -540,7 +553,8 @@ LayerTestResult<int16_t, 4> BatchNormInt16Test( LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { // BatchSize: 1 // Height: 3 @@ -580,6 +594,7 @@ LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest( return BatchNormTestImpl<armnn::DataType::QSymmS16>( workloadFactory, memoryManager, + tensorHandleFactory, inputOutputShape, inputValues, expectedOutputValues, @@ -591,7 +606,9 @@ LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest( LayerTestResult<float,4> CompareBatchNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory) + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory) { IgnoreUnused(memoryManager); const unsigned int width = 2; @@ -619,13 +636,11 @@ LayerTestResult<float,4> CompareBatchNormTest( LayerTestResult<float,4> ret(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> inputHandleRef = refWorkloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refWorkloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandleRef = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refTensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::BatchNormalizationQueueDescriptor data; armnn::WorkloadInfo info; diff --git a/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.hpp index eaffb8238f..f57c061f57 100644 --- a/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/BatchNormalizationTestImpl.hpp @@ -14,37 +14,47 @@ LayerTestResult<float, 4> BatchNormFloat32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> BatchNormFloat32NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> BatchNormFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> BatchNormFloat16NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> BatchNormUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> BatchNormUint8NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> BatchNormInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> CompareBatchNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory); + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp index 38df285920..9d539975c7 100644 --- a/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/BatchToSpaceNdTestImpl.hpp @@ -29,6 +29,7 @@ template<armnn::DataType ArmnnType, LayerTestResult<T, OutputDim> BatchToSpaceNdHelper( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory, const armnn::DataLayout& dataLayout, const unsigned int *inputShape, const std::vector<float> &inputData, @@ -56,10 +57,8 @@ LayerTestResult<T, OutputDim> BatchToSpaceNdHelper( result.outputExpected = MakeTensor<T, OutputDim>(outputTensorInfo, ConvertToDataType<ArmnnType>(outputData, outputTensorInfo)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::BatchToSpaceNdQueueDescriptor data; data.m_Parameters.m_DataLayout = dataLayout; @@ -89,7 +88,8 @@ LayerTestResult<T, OutputDim> BatchToSpaceNdHelper( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 2, 2, 1}; const unsigned int outputShape[] = {1, 4, 4, 1}; @@ -128,7 +128,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1( std::vector<unsigned int> blockShape {2, 2}; std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -136,7 +136,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 2, 2, 1}; @@ -151,7 +152,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -159,7 +160,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 3}; const unsigned int outputShape[] = {1, 2, 2, 3}; @@ -171,7 +173,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -179,7 +181,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {8, 1, 3, 1}; const unsigned int outputShape[] = {2, 2, 4, 1}; @@ -205,7 +208,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -213,7 +216,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest5( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 2, 2, 1}; const unsigned int outputShape[] = {1, 4, 4, 1}; @@ -224,14 +228,16 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest5( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, + armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 2, 2, 1}; @@ -246,7 +252,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -254,7 +260,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 3}; const unsigned int outputShape[] = {1, 2, 2, 3}; @@ -266,7 +273,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -274,7 +281,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest1( armnn::IWorkloadFactory &workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; @@ -298,7 +306,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest1( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -306,7 +314,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest1( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest2( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 1, 2, 2}; @@ -321,7 +330,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest2( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -329,7 +338,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest2( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest3( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; @@ -353,7 +363,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest3( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -361,7 +371,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest3( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest4( armnn::IWorkloadFactory &workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; @@ -385,7 +396,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest4( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -393,7 +404,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest4( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest5( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 1, 2, 2}; @@ -408,7 +420,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest5( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -416,7 +428,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest5( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest6( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; @@ -440,7 +453,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest6( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } @@ -448,7 +461,8 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest6( template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 4> BatchToSpaceNdNchwTest7( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = {8, 1, 1, 3}; const unsigned int outputShape[] = {2, 1, 2, 4}; @@ -470,7 +484,7 @@ LayerTestResult<T, 4> BatchToSpaceNdNchwTest7( std::vector<unsigned int> blockShape({2, 2}); std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}}; - return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, + return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, tensorHandleFactory, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } diff --git a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp index c52c5ce9f2..f3688347d2 100644 --- a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp @@ -18,7 +18,8 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::DivisionQueueDescriptor> LayerTestResult<float, 4> DivisionByZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); const unsigned int width = 2u; @@ -54,12 +55,14 @@ LayerTestResult<float, 4> DivisionByZeroTest( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> DivisionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int width = 2u; const unsigned int height = 2u; @@ -94,12 +97,14 @@ LayerTestResult<float, 4> DivisionTest( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> DivisionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -118,12 +123,14 @@ LayerTestResult<float, 4> DivisionBroadcast1ElementTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> DivisionBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 3, 3, 2 }; unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -152,12 +159,14 @@ LayerTestResult<float, 4> DivisionBroadcast1DVectorTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> DivisionFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -194,12 +203,14 @@ LayerTestResult<armnn::Half, 4> DivisionFloat16Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> DivisionBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -220,12 +231,14 @@ LayerTestResult<armnn::Half, 4> DivisionBroadcast1ElementFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> DivisionBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -256,12 +269,14 @@ LayerTestResult<armnn::Half, 4> DivisionBroadcast1DVectorFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> DivisionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int width = 2u; const unsigned int height = 2u; @@ -297,13 +312,15 @@ LayerTestResult<uint8_t, 4> DivisionUint8Test( input1, shape, output, + tensorHandleFactory, 0.25f, 0); } LayerTestResult<uint8_t, 4> DivisionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -322,12 +339,14 @@ LayerTestResult<uint8_t, 4> DivisionBroadcast1ElementUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> DivisionBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 3, 3, 2 }; unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -356,12 +375,14 @@ LayerTestResult<uint8_t, 4> DivisionBroadcast1DVectorUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t,4> DivisionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -392,13 +413,15 @@ LayerTestResult<int16_t,4> DivisionInt16Test( input1, shape, output, + tensorHandleFactory, 0.25f, 0); } LayerTestResult<int16_t, 4> DivisionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -417,12 +440,14 @@ LayerTestResult<int16_t, 4> DivisionBroadcast1ElementInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> DivisionBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 3, 3, 2 }; unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -451,12 +476,14 @@ LayerTestResult<int16_t, 4> DivisionBroadcast1DVectorInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> DivisionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int width = 2u; const unsigned int height = 2u; @@ -493,13 +520,15 @@ LayerTestResult<int32_t, 4> DivisionInt32Test( input1, shape, output, + tensorHandleFactory, 1.f, 0); } LayerTestResult<int32_t, 4> DivisionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -518,12 +547,14 @@ LayerTestResult<int32_t, 4> DivisionBroadcast1ElementInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> DivisionBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 3, 3, 2 }; unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -552,5 +583,6 @@ LayerTestResult<int32_t, 4> DivisionBroadcast1DVectorInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp index 4e6a910e4f..41467466b2 100644 --- a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp @@ -11,67 +11,82 @@ #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> - LayerTestResult<float, 4> DivisionByZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> DivisionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> DivisionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> DivisionBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> DivisionFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> DivisionBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> DivisionBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> DivisionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> DivisionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> DivisionBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t,4> DivisionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> DivisionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> DivisionBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t,4> DivisionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> DivisionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> DivisionBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/ElementwiseTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/ElementwiseTestImpl.hpp index 79eb2e4419..ec5bfb0396 100644 --- a/src/backends/backendsCommon/test/layerTests/ElementwiseTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/ElementwiseTestImpl.hpp @@ -51,6 +51,7 @@ LayerTestResult<TOutput, NumDims> ElementwiseTestHelper( int quantOffset1, const unsigned int outShape[NumDims], std::vector<TOutput> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float outQuantScale, int outQuantOffset) { @@ -77,11 +78,9 @@ LayerTestResult<TOutput, NumDims> ElementwiseTestHelper( ret.compareBoolean = true; } - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle0 = workloadFactory.CreateTensorHandle(inputTensorInfo0); - std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle0 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo0); + std::unique_ptr<armnn::ITensorHandle> inputHandle1 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); Descriptor data; armnn::WorkloadInfo info; @@ -123,6 +122,7 @@ LayerTestResult<T, NumDims> ElementwiseTestHelper( int quantOffset1, const unsigned int outShape[NumDims], std::vector<T> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float outQuantScale, int outQuantOffset) { @@ -139,6 +139,7 @@ LayerTestResult<T, NumDims> ElementwiseTestHelper( quantOffset1, outShape, outValues, + tensorHandleFactory, outQuantScale, outQuantOffset); } @@ -158,6 +159,7 @@ LayerTestResult<TOutput, NumDims> ElementwiseTestHelper( std::vector<TInput> values1, const unsigned int outShape[NumDims], std::vector<TOutput> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float quantScale = 1.0f, int quantOffset = 0) { @@ -174,6 +176,7 @@ LayerTestResult<TOutput, NumDims> ElementwiseTestHelper( quantOffset, outShape, outValues, + tensorHandleFactory, quantScale, quantOffset); } @@ -191,6 +194,7 @@ LayerTestResult<T, NumDims> ElementwiseTestHelper( std::vector<T> values1, const unsigned int outShape[NumDims], std::vector<T> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float quantScale = 1.0f, int quantOffset = 0) { @@ -203,6 +207,7 @@ LayerTestResult<T, NumDims> ElementwiseTestHelper( values1, outShape, outValues, + tensorHandleFactory, quantScale, quantOffset); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/ElementwiseUnaryTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/ElementwiseUnaryTestImpl.hpp index 863e988c9a..5d37e934ea 100644 --- a/src/backends/backendsCommon/test/layerTests/ElementwiseUnaryTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/ElementwiseUnaryTestImpl.hpp @@ -42,6 +42,7 @@ LayerTestResult<T, NumDims> ElementwiseUnaryTestHelper( int quantOffset, const unsigned int outShape[NumDims], std::vector<float> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float outQuantScale, int outQuantOffset) { @@ -58,10 +59,8 @@ LayerTestResult<T, NumDims> ElementwiseUnaryTestHelper( LayerTestResult<T, NumDims> ret(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle = tensorHandleFactory.CreateTensorHandle(inputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::ElementwiseUnaryDescriptor desc(op); armnn::ElementwiseUnaryQueueDescriptor qDesc; @@ -97,6 +96,7 @@ LayerTestResult<T, NumDims> ElementwiseUnaryTestHelper( std::vector<float> values, const unsigned int outShape[NumDims], std::vector<float> outValues, + const armnn::ITensorHandleFactory& tensorHandleFactory, float quantScale = 1.0f, int quantOffset = 0) { @@ -110,6 +110,7 @@ LayerTestResult<T, NumDims> ElementwiseUnaryTestHelper( quantOffset, outShape, outValues, + tensorHandleFactory, quantScale, quantOffset); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/ExpTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/ExpTestImpl.cpp index 6e68ade1a4..1cc6714e1e 100644 --- a/src/backends/backendsCommon/test/layerTests/ExpTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/ExpTestImpl.cpp @@ -9,7 +9,8 @@ template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> Exp2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 2, 2 }; @@ -32,13 +33,15 @@ LayerTestResult<T, 2> Exp2dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 3> Exp3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 3, 1, 2 }; @@ -63,13 +66,15 @@ LayerTestResult<T, 3> Exp3dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> ExpZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -90,13 +95,15 @@ LayerTestResult<T, 2> ExpZeroTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> ExpNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -117,7 +124,8 @@ LayerTestResult<T, 2> ExpNegativeTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } // @@ -127,59 +135,71 @@ LayerTestResult<T, 2> ExpNegativeTest( template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> Exp2dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 2> Exp2dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 2> Exp2dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 2> Exp2dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 2> Exp2dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 3> Exp3dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 3> Exp3dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 3> Exp3dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 3> Exp3dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 3> Exp3dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> ExpZeroTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> ExpNegativeTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/ExpTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/ExpTestImpl.hpp index 2d49ba9863..91cb669737 100644 --- a/src/backends/backendsCommon/test/layerTests/ExpTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/ExpTestImpl.hpp @@ -15,19 +15,23 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> Exp2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 3> Exp3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> ExpZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> ExpNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/FakeQuantizationTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/FakeQuantizationTestImpl.hpp index 47d885985a..519880e92a 100644 --- a/src/backends/backendsCommon/test/layerTests/FakeQuantizationTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/FakeQuantizationTestImpl.hpp @@ -9,7 +9,6 @@ #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> -#include <backendsCommon/test/WorkloadFactoryHelper.hpp> LayerTestResult<float, 2> FakeQuantizationTest( armnn::IWorkloadFactory& workloadFactory, diff --git a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp index 02fea52c8b..1ef8f9a4e9 100644 --- a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp @@ -16,8 +16,10 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::MaximumQueueDescriptor>( return workloadFactory.CreateMaximum(descriptor, info); } -LayerTestResult<float, 4> MaximumSimpleTest(armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +LayerTestResult<float, 4> MaximumSimpleTest( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); const unsigned int width = 2u; @@ -53,12 +55,14 @@ LayerTestResult<float, 4> MaximumSimpleTest(armnn::IWorkloadFactory& workloadFac shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> MaximumBroadcast1ElementTest( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -77,12 +81,14 @@ LayerTestResult<float, 4> MaximumBroadcast1ElementTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> MaximumBroadcast1DVectorTest( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -109,11 +115,14 @@ LayerTestResult<float, 4> MaximumBroadcast1DVectorTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } -LayerTestResult<armnn::Half, 4> MaximumFloat16Test(armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +LayerTestResult<armnn::Half, 4> MaximumFloat16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -150,15 +159,17 @@ LayerTestResult<armnn::Half, 4> MaximumFloat16Test(armnn::IWorkloadFactory& work shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> MaximumBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; - + unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -176,15 +187,17 @@ LayerTestResult<armnn::Half, 4> MaximumBroadcast1ElementFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> MaximumBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; - + const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -210,12 +223,14 @@ LayerTestResult<armnn::Half, 4> MaximumBroadcast1DVectorFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MaximumUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -246,12 +261,14 @@ LayerTestResult<uint8_t, 4> MaximumUint8Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MaximumBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -278,12 +295,14 @@ LayerTestResult<uint8_t, 4> MaximumBroadcast1ElementUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MaximumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -309,12 +328,14 @@ LayerTestResult<uint8_t, 4> MaximumBroadcast1DVectorUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MaximumInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -335,12 +356,14 @@ LayerTestResult<int16_t, 4> MaximumInt16Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MaximumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -367,12 +390,14 @@ LayerTestResult<int16_t, 4> MaximumBroadcast1ElementInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MaximumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -399,12 +424,14 @@ LayerTestResult<int16_t, 4> MaximumBroadcast1DVectorInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MaximumInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -425,12 +452,14 @@ LayerTestResult<int32_t, 4> MaximumInt32Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MaximumBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -457,12 +486,14 @@ LayerTestResult<int32_t, 4> MaximumBroadcast1ElementInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MaximumBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -489,5 +520,6 @@ LayerTestResult<int32_t, 4> MaximumBroadcast1DVectorInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp index 082ce6e68d..8cc660b76f 100644 --- a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp @@ -12,61 +12,77 @@ #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> -LayerTestResult<float, 4> MaximumSimpleTest(armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); +LayerTestResult<float, 4> MaximumSimpleTest( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> MaximumBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> MaximumBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> MaximumFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> MaximumBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> MaximumBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MaximumUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MaximumBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MaximumBroadcast1DVectorUint8Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MaximumInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MaximumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MaximumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MaximumInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MaximumBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MaximumBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp index 371dc27ea0..015d055dcc 100644 --- a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp @@ -18,7 +18,8 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::MinimumQueueDescriptor>( LayerTestResult<float, 4> MinimumBroadcast1ElementTest1( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { IgnoreUnused(memoryManager); unsigned int shape0[] = { 1, 2, 2, 2 }; @@ -38,12 +39,14 @@ LayerTestResult<float, 4> MinimumBroadcast1ElementTest1( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> MinimumBroadcast1ElementTest2( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -62,12 +65,14 @@ LayerTestResult<float, 4> MinimumBroadcast1ElementTest2( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MinimumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory & workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -94,12 +99,14 @@ LayerTestResult<uint8_t, 4> MinimumBroadcast1DVectorUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> MinimumFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -131,12 +138,14 @@ LayerTestResult<armnn::Half, 4> MinimumFloat16Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> MinimumBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -165,15 +174,16 @@ LayerTestResult<armnn::Half, 4> MinimumBroadcast1ElementFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> MinimumBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; - const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -199,12 +209,14 @@ LayerTestResult<armnn::Half, 4> MinimumBroadcast1DVectorFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MinimumInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -234,12 +246,14 @@ LayerTestResult<int16_t, 4> MinimumInt16Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MinimumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -266,12 +280,14 @@ LayerTestResult<int16_t, 4> MinimumBroadcast1ElementInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MinimumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -298,12 +314,14 @@ LayerTestResult<int16_t, 4> MinimumBroadcast1DVectorInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MinimumInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape[] = { 2, 2, 2, 2 }; @@ -333,12 +351,14 @@ LayerTestResult<int32_t, 4> MinimumInt32Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MinimumBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -365,12 +385,14 @@ LayerTestResult<int32_t, 4> MinimumBroadcast1ElementInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MinimumBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -397,5 +419,6 @@ LayerTestResult<int32_t, 4> MinimumBroadcast1DVectorInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp index f932e64c8b..1e84191908 100644 --- a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp @@ -14,48 +14,60 @@ LayerTestResult<float, 4> MinimumBroadcast1ElementTest1( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> MinimumBroadcast1ElementTest2( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MinimumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory & workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half , 4> MinimumFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> MinimumBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> MinimumBroadcast1DVectorFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t , 4> MinimumInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MinimumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MinimumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t , 4> MinimumInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MinimumBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MinimumBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp index 595fbd4556..b8dc5f5667 100644 --- a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp @@ -6,6 +6,7 @@ #include "MultiplicationTestImpl.hpp" #include "ElementwiseTestImpl.hpp" +#include <reference/test/RefWorkloadFactoryHelper.hpp> template<> std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::MultiplicationQueueDescriptor>( @@ -17,7 +18,8 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::MultiplicationQueueDescr } LayerTestResult<float, 4> MultiplicationTest(armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int width = 2u; const unsigned int height = 2u; @@ -52,11 +54,13 @@ LayerTestResult<float, 4> MultiplicationTest(armnn::IWorkloadFactory& workloadFa shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 5> Multiplication5dTest(armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int width = 3u; const unsigned int height = 2u; @@ -122,12 +126,14 @@ LayerTestResult<float, 5> Multiplication5dTest(armnn::IWorkloadFactory& workload shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> MultiplicationBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 2, 2, 2 }; unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -146,12 +152,14 @@ LayerTestResult<float, 4> MultiplicationBroadcast1ElementTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> MultiplicationBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { unsigned int shape0[] = { 1, 3, 3, 2 }; unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -180,12 +188,14 @@ LayerTestResult<float, 4> MultiplicationBroadcast1DVectorTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MultiplicationUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { constexpr unsigned int batchSize = 1u; constexpr unsigned int channels = 2u; @@ -229,13 +239,15 @@ LayerTestResult<uint8_t, 4> MultiplicationUint8Test( -2, shape, output, + tensorHandleFactory, 1366.255f, -5); } LayerTestResult<uint8_t, 4> MultiplicationBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -262,12 +274,14 @@ LayerTestResult<uint8_t, 4> MultiplicationBroadcast1ElementUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<uint8_t, 4> MultiplicationBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -294,12 +308,14 @@ LayerTestResult<uint8_t, 4> MultiplicationBroadcast1DVectorUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MultiplicationInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape[] = { 1, 2, 2, 3 }; @@ -329,12 +345,14 @@ LayerTestResult<int16_t, 4> MultiplicationInt16Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MultiplicationBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -361,12 +379,14 @@ LayerTestResult<int16_t, 4> MultiplicationBroadcast1ElementInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> MultiplicationBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -393,12 +413,14 @@ LayerTestResult<int16_t, 4> MultiplicationBroadcast1DVectorInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MultiplicationInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape[] = { 1, 2, 2, 3 }; @@ -428,12 +450,14 @@ LayerTestResult<int32_t, 4> MultiplicationInt32Test( shape, input1, shape, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MultiplicationBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -460,12 +484,14 @@ LayerTestResult<int32_t, 4> MultiplicationBroadcast1ElementInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> MultiplicationBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 2, 2, 3 }; const unsigned int shape1[] = { 1, 1, 1, 3 }; @@ -492,13 +518,16 @@ LayerTestResult<int32_t, 4> MultiplicationBroadcast1DVectorInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float,4> CompareMultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory) + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory) { IgnoreUnused(memoryManager); const unsigned int width = 16; @@ -521,15 +550,13 @@ LayerTestResult<float,4> CompareMultiplicationTest( auto input0 = MakeRandomTensor<float, 4>(inputTensorInfo0, 803506992); auto input1 = MakeRandomTensor<float, 4>(inputTensorInfo1, 54902257); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr<armnn::ITensorHandle> inputHandle0 = workloadFactory.CreateTensorHandle(inputTensorInfo0); - std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); + std::unique_ptr<armnn::ITensorHandle> inputHandle0 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo0); + std::unique_ptr<armnn::ITensorHandle> inputHandle1 = tensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.CreateTensorHandle(outputTensorInfo); - std::unique_ptr<armnn::ITensorHandle> inputHandle0Ref = refWorkloadFactory.CreateTensorHandle(inputTensorInfo0); - std::unique_ptr<armnn::ITensorHandle> inputHandle1Ref = refWorkloadFactory.CreateTensorHandle(inputTensorInfo1); - std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refWorkloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr<armnn::ITensorHandle> inputHandle0Ref = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo0); + std::unique_ptr<armnn::ITensorHandle> inputHandle1Ref = refTensorHandleFactory.CreateTensorHandle(inputTensorInfo1); + std::unique_ptr<armnn::ITensorHandle> outputHandleRef = refTensorHandleFactory.CreateTensorHandle(outputTensorInfo); armnn::MultiplicationQueueDescriptor data; armnn::WorkloadInfo info; diff --git a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp index 7ef9c42afd..9d2a95409d 100644 --- a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp @@ -12,57 +12,72 @@ LayerTestResult<float, 4> MultiplicationTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 5> Multiplication5dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> MultiplicationBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> MultiplicationBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MultiplicationUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MultiplicationBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> MultiplicationBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MultiplicationInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MultiplicationBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> MultiplicationBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MultiplicationInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MultiplicationBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> MultiplicationBroadcast1DVectorInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> CompareMultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, - armnn::IWorkloadFactory& refWorkloadFactory); + armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory& tensorHandleFactory, + const armnn::ITensorHandleFactory& refTensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/NegTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/NegTestImpl.cpp index f2ed22238e..d14146827c 100644 --- a/src/backends/backendsCommon/test/layerTests/NegTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/NegTestImpl.cpp @@ -10,7 +10,8 @@ template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> Neg2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 2, 2 }; @@ -33,13 +34,15 @@ LayerTestResult<T, 2> Neg2dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 3> Neg3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 3, 1, 2 }; @@ -62,13 +65,15 @@ LayerTestResult<T, 3> Neg3dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> NegZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -89,13 +94,15 @@ LayerTestResult<T, 2> NegZeroTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> NegNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -116,7 +123,8 @@ LayerTestResult<T, 2> NegNegativeTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } // @@ -126,59 +134,71 @@ LayerTestResult<T, 2> NegNegativeTest( template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> Neg2dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 2> Neg2dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 2> Neg2dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 2> Neg2dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 2> Neg2dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 3> Neg3dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 3> Neg3dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 3> Neg3dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 3> Neg3dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 3> Neg3dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> NegZeroTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> NegNegativeTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager);
\ No newline at end of file + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory);
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/NegTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/NegTestImpl.hpp index 6ceacdebcf..126a754335 100644 --- a/src/backends/backendsCommon/test/layerTests/NegTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/NegTestImpl.hpp @@ -15,19 +15,23 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> Neg2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 3> Neg3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> NegZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> NegNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.cpp index 367c82fb7c..8fb106c22d 100644 --- a/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.cpp @@ -10,7 +10,8 @@ template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> Rsqrt2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 2, 2 }; @@ -33,13 +34,15 @@ LayerTestResult<T, 2> Rsqrt2dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 3> Rsqrt3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 3, 1, 2 }; @@ -62,13 +65,15 @@ LayerTestResult<T, 3> Rsqrt3dTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> RsqrtZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -89,13 +94,15 @@ LayerTestResult<T, 2> RsqrtZeroTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } template<armnn::DataType ArmnnType, typename T> LayerTestResult<T, 2> RsqrtNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int inputShape[] = { 1, 2 }; @@ -116,7 +123,8 @@ LayerTestResult<T, 2> RsqrtNegativeTest( inputShape, inputValues, inputShape, - expectedOutputValues); + expectedOutputValues, + tensorHandleFactory); } // @@ -126,59 +134,71 @@ LayerTestResult<T, 2> RsqrtNegativeTest( template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> Rsqrt2dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 2> Rsqrt2dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 2> Rsqrt2dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 2> Rsqrt2dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 2> Rsqrt2dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 3> Rsqrt3dTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float16>, 3> Rsqrt3dTest<armnn::DataType::Float16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 3> Rsqrt3dTest<armnn::DataType::QAsymmS8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmU8>, 3> Rsqrt3dTest<armnn::DataType::QAsymmU8>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::QSymmS16>, 3> Rsqrt3dTest<armnn::DataType::QSymmS16>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> RsqrtZeroTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 2> RsqrtNegativeTest<armnn::DataType::Float32>( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.hpp index dd7ab66d45..0df9ea7999 100644 --- a/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/RsqrtTestImpl.hpp @@ -15,19 +15,23 @@ template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> Rsqrt2dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 3> Rsqrt3dTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> RsqrtZeroTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>> LayerTestResult<T, 2> RsqrtNegativeTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); diff --git a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp index e95cd5e8cd..f0efe4d233 100644 --- a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp @@ -11,7 +11,6 @@ #include <armnn/backends/IBackendInternal.hpp> #include <backendsCommon/WorkloadFactory.hpp> -#include <backendsCommon/test/WorkloadFactoryHelper.hpp> LayerTestResult<float, 2> SimpleSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, diff --git a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp index eb1ba6b369..3c4946e44a 100644 --- a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp @@ -18,7 +18,8 @@ std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::SubtractionQueueDescript LayerTestResult<uint8_t, 4> SubtractionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 2, 2 }; @@ -40,13 +41,15 @@ LayerTestResult<uint8_t, 4> SubtractionUint8Test( 0, shape0, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<uint8_t, 4> SubtractionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -70,13 +73,15 @@ LayerTestResult<uint8_t, 4> SubtractionBroadcast1ElementUint8Test( 0, shape0, output, + tensorHandleFactory, 1.0f, 3); } LayerTestResult<uint8_t, 4> SubtractionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 2, 1 }; @@ -95,12 +100,14 @@ LayerTestResult<uint8_t, 4> SubtractionBroadcastUint8Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> SubtractionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 2, 2 }; @@ -117,12 +124,14 @@ LayerTestResult<float, 4> SubtractionTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> SubtractionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -141,12 +150,14 @@ LayerTestResult<float, 4> SubtractionBroadcast1ElementTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<float, 4> SubtractionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 1, 2 }; @@ -165,12 +176,14 @@ LayerTestResult<float, 4> SubtractionBroadcastTest( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> SubtractionFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -189,12 +202,14 @@ LayerTestResult<armnn::Half, 4> SubtractionFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> SubtractionBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -215,12 +230,14 @@ LayerTestResult<armnn::Half, 4> SubtractionBroadcast1ElementFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<armnn::Half, 4> SubtractionBroadcastFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { using namespace half_float::literal; @@ -241,12 +258,14 @@ LayerTestResult<armnn::Half, 4> SubtractionBroadcastFloat16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int16_t, 4> SubtractionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape[] = { 1, 1, 2, 2 }; @@ -267,13 +286,15 @@ LayerTestResult<int16_t, 4> SubtractionInt16Test( 0, shape, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<int16_t, 4> SubtractionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -297,13 +318,15 @@ LayerTestResult<int16_t, 4> SubtractionBroadcast1ElementInt16Test( 0, shape0, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<int16_t, 4> SubtractionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 2, 1 }; @@ -322,12 +345,14 @@ LayerTestResult<int16_t, 4> SubtractionBroadcastInt16Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); } LayerTestResult<int32_t, 4> SubtractionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape[] = { 1, 1, 2, 2 }; @@ -348,13 +373,15 @@ LayerTestResult<int32_t, 4> SubtractionInt32Test( 0, shape, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<int32_t, 4> SubtractionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 1, 1 }; @@ -378,13 +405,15 @@ LayerTestResult<int32_t, 4> SubtractionBroadcast1ElementInt32Test( 0, shape0, output, + tensorHandleFactory, 1.0f, 0); } LayerTestResult<int32_t, 4> SubtractionBroadcastInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory) { const unsigned int shape0[] = { 1, 1, 2, 2 }; const unsigned int shape1[] = { 1, 1, 2, 1 }; @@ -403,5 +432,6 @@ LayerTestResult<int32_t, 4> SubtractionBroadcastInt32Test( shape1, input1, shape0, - output); + output, + tensorHandleFactory); }
\ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp index f3de5df74e..6113b029b8 100644 --- a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp @@ -14,60 +14,75 @@ LayerTestResult<float, 4> SubtractionTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> SubtractionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<float, 4> SubtractionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> SubtractionFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> SubtractionBroadcast1ElementFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<armnn::Half, 4> SubtractionBroadcastFloat16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SubtractionUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SubtractionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<uint8_t, 4> SubtractionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SubtractionInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SubtractionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int16_t, 4> SubtractionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> SubtractionInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> SubtractionBroadcast1ElementInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); LayerTestResult<int32_t, 4> SubtractionBroadcastInt32Test( armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + const armnn::ITensorHandleFactory& tensorHandleFactory); |