15 #include <boost/test/unit_test.hpp> 37 template <
typename T, std::
size_t n>
40 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
41 BOOST_CHECK_MESSAGE(testNameIndicatesUnsupported != testResult.
supported,
42 "The test name does not match the supportedness it is reporting");
49 template <
typename T, std::
size_t n>
52 bool testNameIndicatesUnsupported = testName.find(
"UNSUPPORTED") != std::string::npos;
53 for (
unsigned int i = 0; i < testResult.size(); ++i)
55 BOOST_CHECK_MESSAGE(testNameIndicatesUnsupported != testResult[i].
supported,
56 "The test name does not match the supportedness it is reporting");
57 if (testResult[i].supported)
59 BOOST_TEST(
CompareTensors(testResult[i].output, testResult[i].outputExpected));
64 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
67 std::unique_ptr<armnn::IProfiler> profiler = std::make_unique<armnn::IProfiler>();
70 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
71 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
73 auto testResult = (*testFunction)(workloadFactory, memoryManager, args...);
80 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
83 std::unique_ptr<armnn::IProfiler> profiler = std::make_unique<armnn::IProfiler>();
86 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
87 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
89 auto tensorHandleFactory = WorkloadFactoryHelper<FactoryType>::GetTensorHandleFactory(memoryManager);
91 auto testResult = (*testFunction)(workloadFactory, memoryManager, tensorHandleFactory, args...);
97 #define ARMNN_SIMPLE_TEST_CASE(TestName, TestFunction) \ 98 BOOST_AUTO_TEST_CASE(TestName) \ 103 #define ARMNN_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 104 BOOST_AUTO_TEST_CASE(TestName) \ 106 RunTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 109 #define ARMNN_AUTO_TEST_CASE_WITH_THF(TestName, TestFunction, ...) \ 110 BOOST_AUTO_TEST_CASE(TestName) \ 112 RunTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 115 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
118 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
119 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
123 auto testResult = (*testFunction)(workloadFactory, memoryManager, refWorkloadFactory, args...);
127 template<
typename FactoryType,
typename TFuncPtr,
typename... Args>
130 auto memoryManager = WorkloadFactoryHelper<FactoryType>::GetMemoryManager();
131 FactoryType workloadFactory = WorkloadFactoryHelper<FactoryType>::GetFactory(memoryManager);
134 auto tensorHandleFactory = WorkloadFactoryHelper<FactoryType>::GetTensorHandleFactory(memoryManager);
135 auto refTensorHandleFactory =
136 RefWorkloadFactoryHelper::GetTensorHandleFactory(memoryManager);
138 auto testResult = (*testFunction)(
139 workloadFactory, memoryManager, refWorkloadFactory, tensorHandleFactory, refTensorHandleFactory, args...);
143 #define ARMNN_COMPARE_REF_AUTO_TEST_CASE(TestName, TestFunction, ...) \ 144 BOOST_AUTO_TEST_CASE(TestName) \ 146 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 149 #define ARMNN_COMPARE_REF_AUTO_TEST_CASE_WITH_THF(TestName, TestFunction, ...) \ 150 BOOST_AUTO_TEST_CASE(TestName) \ 152 CompareRefTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 155 #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(TestName, Fixture, TestFunction, ...) \ 156 BOOST_FIXTURE_TEST_CASE(TestName, Fixture) \ 158 CompareRefTestFunction<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \ 161 #define ARMNN_COMPARE_REF_FIXTURE_TEST_CASE_WITH_THF(TestName, Fixture, TestFunction, ...) \ 162 BOOST_FIXTURE_TEST_CASE(TestName, Fixture) \ 164 CompareRefTestFunctionUsingTensorHandleFactory<FactoryType>(#TestName, &TestFunction, ##__VA_ARGS__); \
static ProfilerManager & GetInstance()
boost::test_tools::predicate_result CompareTensors(const boost::multi_array< T, n > &a, const boost::multi_array< T, n > &b, bool compareBoolean=false, bool isDynamic=false)
void ConfigureLogging(bool printToStandardOutput, bool printToDebugOutput, LogSeverity severity)
Configures the logging behaviour of the ARMNN library.
ISubgraphViewConverter supported
boost::multi_array< T, n > outputExpected
void CompareRefTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
void RunTestFunctionUsingTensorHandleFactory(const char *testName, TFuncPtr testFunction, Args... args)
void RunTestFunction(const char *testName, TFuncPtr testFunction, Args... args)
void CompareRefTestFunctionUsingTensorHandleFactory(const char *testName, TFuncPtr testFunction, Args... args)
void CompareTestResultIfSupported(const std::string &testName, const LayerTestResult< T, n > &testResult)
Executes BOOST_TEST on CompareTensors() return value so that the predicate_result message is reported...
void ConfigureLoggingTest()
boost::multi_array< T, n > output
void RegisterProfiler(IProfiler *profiler)
ClWorkloadFactory FactoryType