IVGCVSW-3268 Add Reference workload support for the new Prelu Activation layer
* Added reference workload for the PReLU Activation layer
* Added factory methods
* Added validation support
* Added Int16 support
* Added unit tests
Change-Id: Ic950d908c5e0a335dccd2960a3ffab0f8b599876
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp
index 919dd5f..077aa1c 100644
--- a/src/backends/reference/RefLayerSupport.cpp
+++ b/src/backends/reference/RefLayerSupport.cpp
@@ -1353,4 +1353,36 @@
return supported;
}
+bool RefLayerSupport::IsPreluSupported(const TensorInfo& input,
+ const TensorInfo& alpha,
+ const TensorInfo& output,
+ Optional<std::string&> reasonIfUnsupported) const
+{
+ bool supported = true;
+
+ std::array<DataType, 3> supportedTypes
+ {
+ DataType::Float32,
+ DataType::QuantisedAsymm8,
+ DataType::QuantisedSymm16
+ };
+
+ supported &= CheckSupportRule(TypeAnyOf(input, supportedTypes), reasonIfUnsupported,
+ "PReLU: input is not a supported type.");
+
+ supported &= CheckSupportRule(TypeAnyOf(alpha, supportedTypes), reasonIfUnsupported,
+ "PReLU: alpha is not a supported type.");
+
+ supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported,
+ "PReLU: output is not a supported type.");
+
+ supported &= CheckSupportRule(TypesAreEqual(input, alpha, output), reasonIfUnsupported,
+ "PReLU: input, alpha and output types are mismatched");
+
+ supported &= CheckSupportRule(ShapesAreBroadcastCompatible(input, alpha, output), reasonIfUnsupported,
+ "PReLU: shapes are not suitable for implicit broadcast");
+
+ return supported;
+}
+
} // namespace armnn