IVGCVSW-3221 Refactor Mean ref workload and tests
* Renamed RefMeanFloat32Workload and RefMeanUint8Workload
to RefMeanWorkload, updated references to reflect this
change.
* Refactored RefFloorWorkload to use Decoders/Encoders,
to support the use of multiple data types.
* Deleted reference Unit8 Mean tests as they were
duplicates of the Float32 tests. Refactored these tests
to support multiple data types and updated references.
* Adjusted the values used in the tests' input tensors so
that they are more like floating point numbers
e.g. change 1.0f to 1.5f.
* Replace size_t with unsigned int in Mean ref workload,
for better compatibility with the Encoder/Decoder,
removed some unnecessary casts after this.
* Added ValidateTensorDataTypesMatch() function to
WorkloadData.cpp, added CreateIncorrectDimensionsErrorMsg
function to RefLayerSupport.cpp.
* Added passing and failing tests for ref IsMeanSupported.
Signed-off-by: James Conroy <james.conroy@arm.com>
Change-Id: Id3d44463d1385255c727a497d4026d21a49e7eb2
diff --git a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp
index fa6ec10..ff632fc 100644
--- a/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp
+++ b/src/backends/backendsCommon/test/IsLayerSupportedTestImpl.hpp
@@ -633,5 +633,34 @@
return result;
}
+// Tests that IsMeanSupported fails when input tensor dimensions
+// do not match output tensor dimensions when keepDims == true
+template<typename FactoryType, armnn::DataType InputDataType , armnn::DataType OutputDataType>
+bool IsMeanLayerNotSupportedTests(std::string& reasonIfUnsupported)
+{
+ armnn::Graph graph;
+ static const std::vector<unsigned> axes = {};
+ // Set keepDims == true
+ armnn::MeanDescriptor desc(axes, true);
+
+ armnn::Layer* const layer = graph.AddLayer<armnn::MeanLayer>(desc, "LayerName");
+
+ armnn::Layer* const input = graph.AddLayer<armnn::InputLayer>(0, "input");
+ armnn::Layer* const output = graph.AddLayer<armnn::OutputLayer>(0, "output");
+
+ // Mismatching number of tensor dimensions
+ armnn::TensorInfo inputTensorInfo({1, 1, 1, 1}, InputDataType);
+ armnn::TensorInfo outputTensorInfo({1, 1}, OutputDataType);
+
+ input->GetOutputSlot(0).Connect(layer->GetInputSlot(0));
+ input->GetOutputHandler(0).SetTensorInfo(inputTensorInfo);
+ layer->GetOutputSlot(0).Connect(output->GetInputSlot(0));
+ layer->GetOutputHandler(0).SetTensorInfo(outputTensorInfo);
+
+ bool result = FactoryType::IsLayerSupported(*layer, InputDataType, reasonIfUnsupported);
+
+ return result;
+}
+
} //namespace