diff options
author | Teresa Charlin <teresa.charlinreyes@arm.com> | 2019-11-11 12:28:15 +0000 |
---|---|---|
committer | TeresaARM <teresa.charlinreyes@arm.com> | 2019-11-12 11:22:43 +0000 |
commit | d8df0260ced49a2796ff70e96284cf00eb316bcc (patch) | |
tree | 27b7569e7addbf736b5d58ae21d545c362137593 /src/backends/reference/RefLayerSupport.cpp | |
parent | 99d9d4a7c62715328378a95b8140862cb0f599fb (diff) | |
download | armnn-d8df0260ced49a2796ff70e96284cf00eb316bcc.tar.gz |
IVGCVSW-4079 Add support of per-axis quantization to DepthwiseConvolution2d
!android-nn-driver:2260
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: Iad93c1940568ffa65ed314c8871ea66caf4f9e4a
Diffstat (limited to 'src/backends/reference/RefLayerSupport.cpp')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index e98af7097b..3507162de8 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -565,14 +565,29 @@ bool RefLayerSupport::IsDepthwiseConvolutionSupported(const TensorInfo& input, supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, "Reference DepthwiseConvolution2d: output is not a supported type."); - supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, - "Reference DepthwiseConvolution2d: weights is not a supported type."); - supported &= CheckSupportRule(TypesAreEqual(input, output), reasonIfUnsupported, "Reference DepthwiseConvolution2d: input and output types mismatched."); - supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, - "Reference DepthwiseConvolution2d: input and weights types mismatched."); + const DataType inputType = input.GetDataType(); + if (inputType == DataType::QuantisedAsymm8) + { + std::array<DataType, 2> supportedWeightTypes = + { + DataType::QuantisedAsymm8, + DataType::QuantizedSymm8PerAxis + }; + + supported &= CheckSupportRule(TypeAnyOf(weights, supportedWeightTypes), reasonIfUnsupported, + "Reference convolution2d: weights type not supported for quantized input."); + } + else + { + supported &= CheckSupportRule(TypeAnyOf(weights, supportedTypes), reasonIfUnsupported, + "Reference DepthwiseConvolution2d: weights is not a supported type."); + + supported &= CheckSupportRule(TypesAreEqual(input, weights), reasonIfUnsupported, + "Reference DepthwiseConvolution2d: input and weights types mismatched."); + } if (biases.has_value()) { |