diff options
author | Francis Murtagh <francis.murtagh@arm.com> | 2020-03-10 13:51:45 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-03-10 14:02:00 +0000 |
commit | ddb1d06dbcb5dc4a89a237ac1176279669817f46 (patch) | |
tree | e2d1104bea631f8f366f529201041e701d09b998 /src/backends/reference/RefLayerSupport.cpp | |
parent | 6445cfff7519effd1df04eac88ae17d6e4e6693b (diff) | |
download | armnn-ddb1d06dbcb5dc4a89a237ac1176279669817f46.tar.gz |
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
Diffstat (limited to 'src/backends/reference/RefLayerSupport.cpp')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index bd2e7289d8..cb94955e7a 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -815,11 +815,12 @@ bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, 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 @@ bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, 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) { |