From 56785c75037ed0cd377851616634b3129713394b Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Thu, 27 Aug 2020 12:57:20 +0100 Subject: IVGCVSW-5257 'Remove CreateTensorHandle in the test for layers beginning with S' * Re-factored SoftmaxTestImpl to use TensorHandleFactory to create TensorHandles Signed-off-by: Sadik Armagan Change-Id: I83559a89187bbed0d6f34ca589ea81c694bf5683 --- src/armnn/test/UnitTests.hpp | 24 ++++++ .../test/layerTests/SoftmaxTestImpl.cpp | 91 ++++++++++++++-------- .../test/layerTests/SoftmaxTestImpl.hpp | 22 +++++- src/backends/cl/test/ClLayerTests.cpp | 14 ++-- src/backends/neon/test/NeonLayerTests.cpp | 16 ++-- src/backends/reference/test/RefLayerTests.cpp | 64 +++++++-------- 6 files changed, 149 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/armnn/test/UnitTests.hpp b/src/armnn/test/UnitTests.hpp index 058a932d03..c049f578fc 100644 --- a/src/armnn/test/UnitTests.hpp +++ b/src/armnn/test/UnitTests.hpp @@ -7,6 +7,8 @@ #include #include #include +#include + #include #include #include "TensorHelpers.hpp" @@ -122,12 +124,34 @@ void CompareRefTestFunction(const char* testName, TFuncPtr testFunction, Args... CompareTestResultIfSupported(testName, testResult); } +template +void CompareRefTestFunctionUsingTensorHandleFactory(const char* testName, TFuncPtr testFunction, Args... args) +{ + auto memoryManager = WorkloadFactoryHelper::GetMemoryManager(); + FactoryType workloadFactory = WorkloadFactoryHelper::GetFactory(memoryManager); + + armnn::RefWorkloadFactory refWorkloadFactory; + auto tensorHandleFactory = WorkloadFactoryHelper::GetTensorHandleFactory(memoryManager); + auto refTensorHandleFactory = + RefWorkloadFactoryHelper::GetTensorHandleFactory(memoryManager); + + auto testResult = (*testFunction)( + workloadFactory, memoryManager, refWorkloadFactory, &tensorHandleFactory, &refTensorHandleFactory, args...); + CompareTestResultIfSupported(testName, testResult); +} + #define ARMNN_COMPARE_REF_AUTO_TEST_CASE(TestName, TestFunction, ...) \ BOOST_AUTO_TEST_CASE(TestName) \ { \ CompareRefTestFunction(#TestName, &TestFunction, ##__VA_ARGS__); \ } +#define ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(TestName, TestFunction, ...) \ + BOOST_AUTO_TEST_CASE(TestName) \ + { \ + CompareRefTestFunctionUsingTensorHandleFactory(#TestName, &TestFunction, ##__VA_ARGS__); \ + } + #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(TestName, Fixture, TestFunction, ...) \ BOOST_FIXTURE_TEST_CASE(TestName, Fixture) \ { \ diff --git a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp index 1ffb34f932..d26b3dbba8 100644 --- a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp @@ -59,13 +59,13 @@ template SimpleSoftmaxBaseTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, const armnn::TensorShape& inputShape, const std::vector& outputData, const std::vector& inputData, int axis = -1) { - IgnoreUnused(memoryManager); using std::exp; const float qScale = 1.f / 256.f; @@ -87,10 +87,8 @@ LayerTestResult SimpleSoftmaxBaseTestImpl( // Each row is independently softmax'd. auto input = MakeTensor(inputTensorInfo, armnnUtils::QuantizedVector(inputData, qScale, qOffset)); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr inputHandle = tensorHandleFactory->CreateTensorHandle(inputTensorInfo); + std::unique_ptr outputHandle = tensorHandleFactory->CreateTensorHandle(outputTensorInfo); armnn::SoftmaxQueueDescriptor data; data.m_Parameters.m_Beta = beta; @@ -122,6 +120,7 @@ template> LayerTestResult SimpleSoftmaxTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { using std::exp; @@ -143,7 +142,7 @@ LayerTestResult SimpleSoftmaxTestImpl( .5f, 0.f, 0.f, 0.f, }; - return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, beta, + return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, inputShape, outputData, inputData); } @@ -151,6 +150,7 @@ template> LayerTestResult SimpleSoftmaxTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis) { @@ -198,7 +198,7 @@ LayerTestResult SimpleSoftmaxTestImpl( break; } } - return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, beta, + return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, inputShape, outputData, inputData, axis); } @@ -206,13 +206,14 @@ template> LayerTestResult Simple3dSoftmaxTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, const armnn::TensorShape& inputShape, const std::vector& outputData, const std::vector& inputData, int axis = 1) { - return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, beta, + return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, inputShape, outputData, inputData, axis); } @@ -220,6 +221,7 @@ template> LayerTestResult Simple4dSoftmaxTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, const armnn::TensorShape& inputShape, const std::vector& outputData, @@ -227,7 +229,7 @@ LayerTestResult Simple4dSoftmaxTestImpl( int axis = 1) { - return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, beta, + return SimpleSoftmaxBaseTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, inputShape, outputData, inputData, axis); } @@ -236,9 +238,10 @@ LayerTestResult CompareSoftmaxTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory* tensorHandleFactory, + const armnn::ITensorHandleFactory* refTensorHandleFactory, float beta) { - const int batchSize = 20; const int channels = 30; @@ -260,10 +263,8 @@ LayerTestResult CompareSoftmaxTestImpl( LayerTestResult ret(outputTensorInfo); auto input = MakeRandomTensor(inputTensorInfo, 0xF00D, 0.0f, 1.0f); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); - std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr inputHandle = tensorHandleFactory->CreateTensorHandle(inputTensorInfo); + std::unique_ptr outputHandle = tensorHandleFactory->CreateTensorHandle(outputTensorInfo); armnn::SoftmaxQueueDescriptor data; data.m_Parameters.m_Beta = beta; @@ -272,10 +273,10 @@ LayerTestResult CompareSoftmaxTestImpl( AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); - ARMNN_NO_DEPRECATE_WARN_BEGIN - std::unique_ptr outputHandleRef = refWorkloadFactory.CreateTensorHandle(outputTensorInfo); - std::unique_ptr inputHandleRef = refWorkloadFactory.CreateTensorHandle(inputTensorInfo); - ARMNN_NO_DEPRECATE_WARN_END + std::unique_ptr outputHandleRef = + refTensorHandleFactory->CreateTensorHandle(outputTensorInfo); + std::unique_ptr inputHandleRef = + refTensorHandleFactory->CreateTensorHandle(inputTensorInfo); armnn::SoftmaxQueueDescriptor refData = data; armnn::WorkloadInfo refInfo = info; @@ -309,33 +310,38 @@ LayerTestResult CompareSoftmaxTestImpl( LayerTestResult SimpleSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { - return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, beta); + return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta); } LayerTestResult SimpleAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis) { - return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, beta, axis); + return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, + tensorHandleFactory, beta, axis); } LayerTestResult Simple3dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple3dSoftmaxOutputData data; - return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult Simple3dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis) { @@ -423,23 +429,25 @@ LayerTestResult Simple3dAxisSoftmaxTest( } } - return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, inputShape, outputData, inputData, axis); } LayerTestResult Simple4dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple4dSoftmaxData data; - return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, beta, data.inputShape, - data.outputData, data.inputData); + return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, + beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult Simple4dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis) { @@ -594,6 +602,7 @@ LayerTestResult Simple4dAxisSoftmaxTest( return Simple4dSoftmaxTestImpl( workloadFactory, memoryManager, + tensorHandleFactory, beta, inputShape, outputData, @@ -604,20 +613,23 @@ LayerTestResult Simple4dAxisSoftmaxTest( LayerTestResult SimpleSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { - return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, beta); + return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta); } LayerTestResult Simple3dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple3dSoftmaxOutputData data; return Simple3dSoftmaxTestImpl( workloadFactory, memoryManager, + tensorHandleFactory, beta, data.inputShape, data.outputData, @@ -627,68 +639,75 @@ LayerTestResult Simple3dSoftmaxUint8Test( LayerTestResult Simple4dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple4dSoftmaxData data; - return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult SimpleSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { - return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, beta); + return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta); } LayerTestResult Simple3dSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple3dSoftmaxOutputData data; - return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult Simple4dSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple4dSoftmaxData data; - return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult SimpleSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { - return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, beta); + return SimpleSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta); } LayerTestResult Simple3dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple3dSoftmaxOutputData data; - return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple3dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } LayerTestResult Simple4dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta) { Simple4dSoftmaxData data; - return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, beta, + return Simple4dSoftmaxTestImpl(workloadFactory, memoryManager, tensorHandleFactory, beta, data.inputShape, data.outputData, data.inputData); } @@ -696,18 +715,22 @@ LayerTestResult CompareSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory* tensorHandleFactory, + const armnn::ITensorHandleFactory* refTensorHandleFactory, float beta) { return CompareSoftmaxTestImpl( - workloadFactory, memoryManager, refWorkloadFactory, beta); + workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, refTensorHandleFactory, beta); } LayerTestResult CompareSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory* tensorHandleFactory, + const armnn::ITensorHandleFactory* refTensorHandleFactory, float beta) { return CompareSoftmaxTestImpl( - workloadFactory, memoryManager, refWorkloadFactory, beta); + workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, refTensorHandleFactory, beta); } diff --git a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp index e0dfd10764..478d3803a1 100644 --- a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -11,93 +11,113 @@ #include #include +#include LayerTestResult SimpleSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult SimpleAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis); LayerTestResult Simple3dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple3dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis); LayerTestResult Simple4dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple4dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta, int axis); LayerTestResult SimpleSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple3dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple4dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult SimpleSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple3dSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple4dSoftmaxFloat16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult SimpleSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple3dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult Simple4dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, + armnn::ITensorHandleFactory* tensorHandleFactory, float beta); LayerTestResult CompareSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory* tensorHandleFactory, + const armnn::ITensorHandleFactory* refTensorHandleFactory, float beta); LayerTestResult CompareSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, + const armnn::ITensorHandleFactory* tensorHandleFactory, + const armnn::ITensorHandleFactory* refTensorHandleFactory, float beta); diff --git a/src/backends/cl/test/ClLayerTests.cpp b/src/backends/cl/test/ClLayerTests.cpp index 91ab591a50..e0c770bb6f 100644 --- a/src/backends/cl/test/ClLayerTests.cpp +++ b/src/backends/cl/test/ClLayerTests.cpp @@ -657,10 +657,10 @@ ARMNN_AUTO_TEST_CASE(NotEqualBroadcast1ElementUint8, NotEqualBroadcast1ElementUi ARMNN_AUTO_TEST_CASE(NotEqualBroadcast1dVectorUint8, NotEqualBroadcast1dVectorUint8Test) // Softmax -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) // LogSoftmax ARMNN_AUTO_TEST_CASE(LogSoftmaxFloat32_1, LogSoftmaxTest1) @@ -1219,9 +1219,9 @@ ARMNN_AUTO_TEST_CASE(Exp3dFloat16, Exp3dTest) // ============================================================================ // COMPARE tests -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8, CompareSoftmaxUint8Test, 1.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxUint8, CompareSoftmaxUint8Test, 1.0f) ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareConv2dWithReference, CompareConvolution2dTest) diff --git a/src/backends/neon/test/NeonLayerTests.cpp b/src/backends/neon/test/NeonLayerTests.cpp index cdcf521e8e..7b0f9788d9 100644 --- a/src/backends/neon/test/NeonLayerTests.cpp +++ b/src/backends/neon/test/NeonLayerTests.cpp @@ -495,10 +495,10 @@ ARMNN_AUTO_TEST_CASE(Tanh, TanhTest) ARMNN_AUTO_TEST_CASE(Elu, EluTest) // Softmax -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) // LogSoftmax ARMNN_AUTO_TEST_CASE(LogSoftmaxFloat32_1, LogSoftmaxTest1) @@ -1343,11 +1343,11 @@ ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareL2Pooling2dWithReference, ComparePooling ARMNN_COMPARE_REF_AUTO_TEST_CASE(UNSUPPORTED_CompareL2Pooling2dWithReferenceUint8, ComparePooling2dUint8Test, PoolingAlgorithm::L2) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta1WithReference, CompareSoftmaxUint8Test, 1.0f) -ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta2WithReference, CompareSoftmaxUint8Test, 2.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxUint8Beta1WithReference, CompareSoftmaxUint8Test, 1.0f) +ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(CompareSoftmaxUint8Beta2WithReference, CompareSoftmaxUint8Test, 2.0f) ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAddition, CompareAdditionTest) diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index 1a71071735..932f242dbc 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -463,48 +463,48 @@ ARMNN_AUTO_TEST_CASE(SimpleNormalizationWithin, SimpleNormalizationWithinTest) ARMNN_AUTO_TEST_CASE(SimpleNormalizationAcrossNhwc, SimpleNormalizationAcrossNhwcTest) // Softmax -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f) -ARMNN_AUTO_TEST_CASE(Simple3dSoftmax, Simple3dSoftmaxTest, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple3dSoftmaxUint8, Simple3dSoftmaxUint8Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dSoftmax, Simple3dSoftmaxTest, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dSoftmaxUint8, Simple3dSoftmaxUint8Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple4dSoftmax, Simple4dSoftmaxTest, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple4dSoftmaxUint8, Simple4dSoftmaxUint8Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dSoftmax, Simple4dSoftmaxTest, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dSoftmaxUint8, Simple4dSoftmaxUint8Test, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxFloat16, SimpleSoftmaxFloat16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple3dSoftmaxFloat16, Simple3dSoftmaxFloat16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple4dSoftmaxFloat16, Simple4dSoftmaxFloat16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxFloat16, SimpleSoftmaxFloat16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dSoftmaxFloat16, Simple3dSoftmaxFloat16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dSoftmaxFloat16, Simple4dSoftmaxFloat16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(SimpleSoftmaxUint16, SimpleSoftmaxUint16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple3dSoftmaxUint16, Simple3dSoftmaxUint16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple4dSoftmaxUint16, Simple4dSoftmaxUint16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(SimpleSoftmaxUint16, SimpleSoftmaxUint16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dSoftmaxUint16, Simple3dSoftmaxUint16Test, 1.0f) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dSoftmaxUint16, Simple4dSoftmaxUint16Test, 1.0f) -ARMNN_AUTO_TEST_CASE(Simple2dAxis0Softmax, SimpleAxisSoftmaxTest, 1.0f, 0) -ARMNN_AUTO_TEST_CASE(Simple2dAxis1Softmax, SimpleAxisSoftmaxTest, 1.0f, 1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple2dAxis0Softmax, SimpleAxisSoftmaxTest, 1.0f, 0) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple2dAxis1Softmax, SimpleAxisSoftmaxTest, 1.0f, 1) -ARMNN_AUTO_TEST_CASE(Simple2dAxis0NegSoftmax, SimpleAxisSoftmaxTest, 1.0f, -2) -ARMNN_AUTO_TEST_CASE(Simple2dAxis1NegSoftmax, SimpleAxisSoftmaxTest, 1.0f, -1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple2dAxis0NegSoftmax, SimpleAxisSoftmaxTest, 1.0f, -2) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple2dAxis1NegSoftmax, SimpleAxisSoftmaxTest, 1.0f, -1) -ARMNN_AUTO_TEST_CASE(Simple3dAxis0Softmax, Simple3dAxisSoftmaxTest, 1.0f, 0) -ARMNN_AUTO_TEST_CASE(Simple3dAxis1Softmax, Simple3dAxisSoftmaxTest, 1.0f, 1) -ARMNN_AUTO_TEST_CASE(Simple3dAxis2Softmax, Simple3dAxisSoftmaxTest, 1.0f, 2) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis0Softmax, Simple3dAxisSoftmaxTest, 1.0f, 0) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis1Softmax, Simple3dAxisSoftmaxTest, 1.0f, 1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis2Softmax, Simple3dAxisSoftmaxTest, 1.0f, 2) -ARMNN_AUTO_TEST_CASE(Simple3dAxis0NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -3) -ARMNN_AUTO_TEST_CASE(Simple3dAxis1NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -2) -ARMNN_AUTO_TEST_CASE(Simple3dAxis2NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis0NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -3) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis1NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -2) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple3dAxis2NegSoftmax, Simple3dAxisSoftmaxTest, 1.0f, -1) -ARMNN_AUTO_TEST_CASE(Simple4dAxis0Softmax, Simple4dAxisSoftmaxTest, 1.0f, 0) -ARMNN_AUTO_TEST_CASE(Simple4dAxis1Softmax, Simple4dAxisSoftmaxTest, 1.0f, 1) -ARMNN_AUTO_TEST_CASE(Simple4dAxis2Softmax, Simple4dAxisSoftmaxTest, 1.0f, 2) -ARMNN_AUTO_TEST_CASE(Simple4dAxis3Softmax, Simple4dAxisSoftmaxTest, 1.0f, 3) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis0Softmax, Simple4dAxisSoftmaxTest, 1.0f, 0) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis1Softmax, Simple4dAxisSoftmaxTest, 1.0f, 1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis2Softmax, Simple4dAxisSoftmaxTest, 1.0f, 2) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis3Softmax, Simple4dAxisSoftmaxTest, 1.0f, 3) -ARMNN_AUTO_TEST_CASE(Simple4dAxis0NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -4) -ARMNN_AUTO_TEST_CASE(Simple4dAxis1NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -3) -ARMNN_AUTO_TEST_CASE(Simple4dAxis2NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -2) -ARMNN_AUTO_TEST_CASE(Simple4dAxis3NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -1) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis0NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -4) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis1NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -3) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis2NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -2) +ARMNN_AUTO_TEST_CASE_WITH_THF(Simple4dAxis3NegSoftmax, Simple4dAxisSoftmaxTest, 1.0f, -1) // Sigmoid Activation ARMNN_AUTO_TEST_CASE(SimpleSigmoid, SimpleSigmoidTest) -- cgit v1.2.1