From 14cbfb2921990d8bf125231e350e2ac8dcd95a8b Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Wed, 23 Oct 2019 10:53:10 +0100 Subject: COMPMID-2609: Enable quantization with multiplier greater than 1 on OpenCL Change-Id: I050f1f84e214e61f7cbb0197a672b68a4940edae Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/2158 Comments-Addressed: Arm Jenkins Reviewed-by: Manuel Bottini Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena --- tests/validation/reference/DepthwiseConvolutionLayer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/validation/reference/DepthwiseConvolutionLayer.cpp') diff --git a/tests/validation/reference/DepthwiseConvolutionLayer.cpp b/tests/validation/reference/DepthwiseConvolutionLayer.cpp index 608093d381..0c7e92b8d0 100644 --- a/tests/validation/reference/DepthwiseConvolutionLayer.cpp +++ b/tests/validation/reference/DepthwiseConvolutionLayer.cpp @@ -197,7 +197,7 @@ SimpleTensor depthwise_convolution_quantized(const SimpleTensor &src, cons int output_shift = 0; const float weights_scale = (is_quantized_per_channel) ? weights_scale_vec[out_z] : weights_scale_vec[0]; const float multiplier = input_scale * weights_scale / output_scale; - arm_compute::quantization::calculate_quantized_multiplier_less_than_one(multiplier, &output_multiplier, &output_shift); + arm_compute::quantization::calculate_quantized_multiplier(multiplier, &output_multiplier, &output_shift); for(int y = minimum_y; y <= minimum_y + maximum_y; y += conv_info.stride().second) { @@ -220,9 +220,8 @@ SimpleTensor depthwise_convolution_quantized(const SimpleTensor &src, cons } } val += bias_val; - val = asymm_rounding_divide_by_pow2(asymm_int_mult(val, output_multiplier), output_shift); - val += output_offset; - val = utility::clamp(val, 0, 255); + // Quantize down + val = quantize_down_scale_by_fixedpoint(val, output_multiplier, output_shift, output_offset, 0, 255); // Store the result dst[out_pos++] = val; -- cgit v1.2.1