aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/CreateWorkload.hpp
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/armnn/test/CreateWorkload.hpp
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/armnn/test/CreateWorkload.hpp')
-rw-r--r--src/armnn/test/CreateWorkload.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/armnn/test/CreateWorkload.hpp b/src/armnn/test/CreateWorkload.hpp
index 5308a1c1dc..c0d2ab1c7f 100644
--- a/src/armnn/test/CreateWorkload.hpp
+++ b/src/armnn/test/CreateWorkload.hpp
@@ -1021,4 +1021,37 @@ std::unique_ptr<ConvertFp32ToFp16Float16Workload> CreateConvertFp32ToFp16Workloa
return workload;
}
+template <typename MeanWorkload, armnn::DataType DataType>
+std::unique_ptr<MeanWorkload> CreateMeanWorkloadTest(armnn::IWorkloadFactory& factory, armnn::Graph& graph)
+{
+ // Reduce along the first and second dimensions, and do not keep the reduced dimensions.
+ MeanDescriptor descriptor({ 1, 2 }, false);
+
+ // Creates the layer we're testing.
+ Layer* const layer = graph.AddLayer<MeanLayer>(descriptor, "mean");
+
+ // Creates extra layers.
+ Layer* const input = graph.AddLayer<InputLayer>(0, "input");
+ Layer* const output = graph.AddLayer<OutputLayer>(0, "output");
+
+ // Connects up.
+ armnn::TensorInfo inputTensorInfo({ 1, 3, 7, 4 }, DataType);
+ armnn::TensorInfo outputTensorInfo({ 1, 4 }, DataType);
+ Connect(input, layer, inputTensorInfo);
+ Connect(layer, output, outputTensorInfo);
+ CreateTensorHandles(graph, factory);
+
+ // Makes the workload and checks it.
+ auto workload = MakeAndCheckWorkload<MeanWorkload>(*layer, graph, factory);
+
+ MeanQueueDescriptor queueDescriptor = workload->GetData();
+ BOOST_TEST(queueDescriptor.m_Parameters.m_Axis == descriptor.m_Axis);
+ BOOST_TEST(queueDescriptor.m_Parameters.m_KeepDims == descriptor.m_KeepDims);
+ BOOST_TEST(queueDescriptor.m_Inputs.size() == 1);
+ BOOST_TEST(queueDescriptor.m_Outputs.size() == 1);
+
+ // Returns so we can do extra, backend-specific tests.
+ return workload;
+}
+
}