From 28dcab6c176a3938519809aa9da7321e4ede7623 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Fri, 19 Oct 2018 16:40:03 +0100 Subject: 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 --- src/armnn/test/CreateWorkload.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/armnn/test') 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 CreateConvertFp32ToFp16Workloa return workload; } +template +std::unique_ptr 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(descriptor, "mean"); + + // Creates extra layers. + Layer* const input = graph.AddLayer(0, "input"); + Layer* const output = graph.AddLayer(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(*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; +} + } -- cgit v1.2.1