diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2019-07-17 15:59:32 +0100 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2019-07-17 16:22:42 +0000 |
commit | ff2719299ea76a95f20a35a7900875a8152e293a (patch) | |
tree | e7183168ea86d92e1a244cea78cac8a375e97ad3 /src/core | |
parent | ca1f460ec33e84b9df84e29de3c3b733e6042b9c (diff) | |
download | ComputeLibrary-ff2719299ea76a95f20a35a7900875a8152e293a.tar.gz |
COMPMID-2336: Fix validation for quantized NEDepthwiseConvolutionLayer
Assertions from calculate_quantized_multiplier_less_than_one were not
captured resulting in incorrect computation being performed on invalid
inputs.
This patch also fixes a discrepancy between the interfaces of validate
and configure methods of NEDirectConvolutionLayerOutputStageKernel.
Change-Id: I011822f63b4062b5b3346ef047adc684e0bffa3d
Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1552
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp b/src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp index 7e113935c5..7c029a6b54 100644 --- a/src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp +++ b/src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.cpp @@ -42,14 +42,18 @@ using namespace arm_compute; namespace { -Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output) +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, + int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift) { + ARM_COMPUTE_UNUSED(result_fixedpoint_multiplier); + ARM_COMPUTE_UNUSED(result_offset_after_shift); ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(input); ARM_COMPUTE_RETURN_ERROR_ON(input->data_layout() == DataLayout::UNKNOWN); ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::F16, DataType::S32, DataType::F32); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(result_shift < 0, "Result shift must be a non negative integer"); if(bias != nullptr) { ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(bias, 1, DataType::F16, DataType::S32, DataType::F32); @@ -475,7 +479,8 @@ void NEDirectConvolutionLayerOutputStageKernel::configure(ITensor *input, const } // Perform validation step - ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias == nullptr) ? nullptr : bias->info(), (output == nullptr) ? nullptr : output->info())); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias == nullptr) ? nullptr : bias->info(), (output == nullptr) ? nullptr : output->info(), + result_fixedpoint_multiplier, result_shift, result_offset_after_shift)); _func = nullptr; _bias = bias; @@ -577,9 +582,10 @@ void NEDirectConvolutionLayerOutputStageKernel::configure(ITensor *input, const } } -Status NEDirectConvolutionLayerOutputStageKernel::validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output) +Status NEDirectConvolutionLayerOutputStageKernel::validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, + int result_fixedpoint_multiplier, int result_shift, int result_offset_after_shift) { - ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, bias, output)); + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, bias, output, result_fixedpoint_multiplier, result_shift, result_offset_after_shift)); ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), bias == nullptr ? nullptr : bias->clone().get(), output == nullptr ? nullptr : output->clone().get()).first); return Status{}; |