aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl/test/ClCreateWorkloadTests.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2018-10-19 16:40:03 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-10-25 14:06:56 +0100
commit28dcab6c176a3938519809aa9da7321e4ede7623 (patch)
treef83cebcf0c89e9b9f9464292e14268b90c8cc628 /src/backends/cl/test/ClCreateWorkloadTests.cpp
parent70104000ddcf3bc1a1d21f16d1468456ca17b80a (diff)
downloadarmnn-28dcab6c176a3938519809aa9da7321e4ede7623.tar.gz
IVGCVSW-2049 + IVGCVSW-2051 Create the CL Mean Float workload and add
the unit tests * Created the ClFloatWorkload class * Added ClMeanValidate validation function * Added helper function to convert the reduction axes from the ArmNN format to ACL's * Added workload tests * Added some unit tests * These changes need the CL pin to be pointing at least to revision 88d871028eeae57f9e4536d0329110eccb5e2890 (COMPMID-1574 Implement ReduceMean in OpenCL) !android-nn-driver:155033 Change-Id: I694fd36be0458c90e158172afde045fcc88c32ae
Diffstat (limited to 'src/backends/cl/test/ClCreateWorkloadTests.cpp')
-rw-r--r--src/backends/cl/test/ClCreateWorkloadTests.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/backends/cl/test/ClCreateWorkloadTests.cpp b/src/backends/cl/test/ClCreateWorkloadTests.cpp
index 4f9989405d..2a705de99b 100644
--- a/src/backends/cl/test/ClCreateWorkloadTests.cpp
+++ b/src/backends/cl/test/ClCreateWorkloadTests.cpp
@@ -14,8 +14,6 @@
#include <backends/cl/workloads/ClWorkloads.hpp>
#include <backends/cl/workloads/ClWorkloadUtils.hpp>
-#include <backends/reference/RefWorkloadFactory.hpp>
-
boost::test_tools::predicate_result CompareIClTensorHandleShape(IClTensorHandle* tensorHandle,
std::initializer_list<unsigned int> expectedDimensions)
{
@@ -739,4 +737,36 @@ BOOST_AUTO_TEST_CASE(CreateResizeBilinearFloat16NhwcWorkload)
ClResizeBilinearWorkloadTest<ClResizeBilinearFloatWorkload, armnn::DataType::Float16>(DataLayout::NHWC);
}
+template <typename MeanWorkloadType, typename armnn::DataType DataType>
+static void ClMeanWorkloadTest()
+{
+ Graph graph;
+ ClWorkloadFactory factory;
+ auto workload = CreateMeanWorkloadTest<MeanWorkloadType, DataType>(factory, graph);
+
+ // Checks that inputs/outputs are as we expect them (see definition of CreateMeanWorkloadTest).
+ MeanQueueDescriptor queueDescriptor = workload->GetData();
+ auto inputHandle = boost::polymorphic_downcast<IClTensorHandle*>(queueDescriptor.m_Inputs[0]);
+ auto outputHandle = boost::polymorphic_downcast<IClTensorHandle*>(queueDescriptor.m_Outputs[0]);
+
+ // The first dimension (batch size) in both input and output is singular thus it has been reduced by ACL.
+ BOOST_TEST(CompareIClTensorHandleShape(inputHandle, { 3, 7, 4 }));
+ BOOST_TEST(CompareIClTensorHandleShape(outputHandle, { 4 }));
+}
+
+BOOST_AUTO_TEST_CASE(CreateMeanFloat32Workload)
+{
+ ClMeanWorkloadTest<ClMeanWorkload, armnn::DataType::Float32>();
+}
+
+BOOST_AUTO_TEST_CASE(CreateMeanFloat16Workload)
+{
+ ClMeanWorkloadTest<ClMeanWorkload, armnn::DataType::Float16>();
+}
+
+BOOST_AUTO_TEST_CASE(CreateMeanUint8Workload)
+{
+ ClMeanWorkloadTest<ClMeanWorkload, armnn::DataType::QuantisedAsymm8>();
+}
+
BOOST_AUTO_TEST_SUITE_END()