IVGCVSW-3226 Refactor the reference normalization workload
* Refactored RefNormalizationFloat32Workload into RefNormalizationWorkload
* Added ref support of Uint8 norm workloads
* Added workload unit tests for Uint8
Change-Id: I063ce919c267e02a32e739848e49d75fd98a5eb6
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp
index f177385..6053608 100644
--- a/src/backends/reference/RefLayerSupport.cpp
+++ b/src/backends/reference/RefLayerSupport.cpp
@@ -959,12 +959,29 @@
const NormalizationDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported) const
{
- ignore_unused(output);
ignore_unused(descriptor);
- return IsSupportedForDataTypeRef(reasonIfUnsupported,
- input.GetDataType(),
- &TrueFunc<>,
- &FalseFuncU8<>);
+
+ // Define supported types
+ std::array<DataType, 3> supportedTypes =
+ {
+ DataType::Float16,
+ DataType::Float32,
+ DataType::QuantisedAsymm8
+ };
+
+ bool supported = true;
+
+ supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported,
+ "Reference normalization: input type not supported.");
+
+ supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported,
+ "Reference normalization: output type not supported.");
+
+ supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported,
+ "Reference normalization: input and output shapes have different "
+ "num total elements.");
+
+ return supported;
}
bool RefLayerSupport::IsOutputSupported(const TensorInfo& output,