aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2019-08-22 16:20:04 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2019-08-24 12:12:28 +0000
commit601ba3f3ee78f6bbc2d046648b064b9aaa7e88a6 (patch)
tree8655f8d67fddc040321120d2f5505d41948cedaf /src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp
parent3e183d98b28ff7c91bbb7166b6f4684cd0e6bd2e (diff)
downloadComputeLibrary-601ba3f3ee78f6bbc2d046648b064b9aaa7e88a6.tar.gz
COMPMID-2336: Validate multiplier and offset calculation in LSTMQuantized and DepthwiseConvolution functions
This patch also adds validation of internal functions in LSTMQuantizedLayer. Change-Id: Id8dbbfbb421f7d053410476b4bb4ef7d85e5f41e Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Signed-off-by: giuros01 <giuseppe.rossini@arm.com> Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/1794 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp
index c91dcece80..42e5fbc8f2 100644
--- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp
+++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp
@@ -80,6 +80,17 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *weights,
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(output->tensor_shape(), output_shape);
}
+ if(is_qasymm)
+ {
+ const UniformQuantizationInfo iq_info = input->quantization_info().uniform();
+ const UniformQuantizationInfo wq_info = weights->quantization_info().uniform();
+ const UniformQuantizationInfo oq_info = (output->total_size() != 0) ? output->quantization_info().uniform() : iq_info;
+
+ float multiplier = iq_info.scale * wq_info.scale / oq_info.scale;
+ ARM_COMPUTE_UNUSED(multiplier);
+ ARM_COMPUTE_RETURN_ERROR_ON(multiplier > 1.0f);
+ }
+
return Status{};
}