MLCE-159 Add QAsymmS8 to ArmnnQuantizer
* Allow per layer quantization from Fp32 to Int8 (QAsymmS8) like TfLite
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Change-Id: I5bbf770aa29d81af3568c15b47d2b2c18e55bb28
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp
index bd2e728..cb94955 100644
--- a/src/backends/reference/RefLayerSupport.cpp
+++ b/src/backends/reference/RefLayerSupport.cpp
@@ -815,11 +815,12 @@
bool supported = true;
// Define supported types.
- std::array<DataType,4> supportedTypes =
+ std::array<DataType,5> supportedTypes =
{
DataType::Float32,
DataType::Float16,
DataType::QAsymmU8,
+ DataType::QAsymmS8,
DataType::QSymmS16
};
@@ -835,8 +836,29 @@
supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported,
"Reference Fully Connected: weights type not supported.");
- supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported,
- "Reference Fully Connected: input and weight types mismatched.");
+ ARMNN_NO_DEPRECATE_WARN_BEGIN
+ std::array<DataType, 3> supportedWeightTypes =
+ {
+ DataType::QAsymmU8,
+ DataType::QSymmS8,
+ DataType::QuantizedSymm8PerAxis // deprecated
+ };
+ ARMNN_NO_DEPRECATE_WARN_END
+
+ if (IsQuantized8BitType(input.GetDataType()))
+ {
+
+ supported &= CheckSupportRule(TypeAnyOf(weights, supportedWeightTypes), reasonIfUnsupported,
+ "Reference Fully Connected: weights type not supported for quantized input.");
+ }
+ else
+ {
+ supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported,
+ "Reference Fully Connected: weights is not a supported type.");
+
+ supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported,
+ "Reference Fully Connected: input and weights types mismatched.");
+ }
if (descriptor.m_BiasEnabled)
{