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 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/armnn/test') 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) \ { \ -- cgit v1.2.1