From b6869dda4a5bf233df009eaac15cf0c220b653f2 Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Wed, 16 Dec 2020 15:34:25 +0000 Subject: Adding no padding check asserts to specific CL Kernels Resolves COMPMID-3905 Updates following kernels:: - CLDeconvolutionLayerUpsampleKernel - CLDeconvolutionReshapeOutputKernel - CLInstanceNormalizationLayerKernel - CLMaxUnpoolingLayerKernel - CLPermuteKernel - CLQLSTMLayerNormalizationKernel - CLReorgLayerKernel - CLReverseKernel - CLSpaceToBatchLayerKernel - CLSpaceToDepthLayerKernel - CLGenerateProposalsLayerKernel - CLFFTDigitReverseKernel - CLFFTRadixStageKernel - CLFFTScaleKernel - CLFillBorderKernel - CLGatherKernel - CLStridedSliceKernel - CLBoundingBoxTransformKernel Change-Id: I067ec670ff9cceadb1dfbf60dabef311a567d99a Signed-off-by: Manuel Bottini Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4713 Comments-Addressed: Arm Jenkins Reviewed-by: Giorgio Arena Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp | 2 ++ src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp | 2 ++ src/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.cpp | 2 ++ src/core/CL/kernels/CLFFTDigitReverseKernel.cpp | 2 ++ src/core/CL/kernels/CLFFTRadixStageKernel.cpp | 2 ++ src/core/CL/kernels/CLFFTScaleKernel.cpp | 2 ++ src/core/CL/kernels/CLFillBorderKernel.cpp | 2 ++ src/core/CL/kernels/CLGatherKernel.cpp | 2 ++ src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLMaxUnpoolingLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLPermuteKernel.cpp | 7 +++++-- src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp | 2 ++ src/core/CL/kernels/CLReorgLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLReverseKernel.cpp | 2 ++ src/core/CL/kernels/CLSpaceToBatchLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp | 2 ++ src/core/CL/kernels/CLStridedSliceKernel.cpp | 2 ++ 18 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp b/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp index bcfd9b8e5a..2c12275e57 100644 --- a/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp +++ b/src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp @@ -97,6 +97,7 @@ void CLBoundingBoxTransformKernel::configure(const ICLTensor *boxes, ICLTensor * void CLBoundingBoxTransformKernel::configure(const CLCompileContext &compile_context, const ICLTensor *boxes, ICLTensor *pred_boxes, const ICLTensor *deltas, const BoundingBoxTransformInfo &info) { ARM_COMPUTE_ERROR_ON_NULLPTR(boxes, pred_boxes, deltas); + auto padding_info = get_padding_info({ boxes, pred_boxes, deltas }); auto_init_if_empty(*pred_boxes->info(), deltas->info()->clone()->set_data_type(boxes->info()->data_type()).set_quantization_info(boxes->info()->quantization_info())); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(boxes->info(), pred_boxes->info(), deltas->info(), info)); @@ -149,6 +150,7 @@ void CLBoundingBoxTransformKernel::configure(const CLCompileContext &compile_con const unsigned int num_elems_processed_per_iteration = 4; Window win = calculate_max_window(*deltas->info(), Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLBoundingBoxTransformKernel::validate(const ITensorInfo *boxes, const ITensorInfo *pred_boxes, const ITensorInfo *deltas, const BoundingBoxTransformInfo &info) diff --git a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp index d01a00d61e..d28cffa05f 100644 --- a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp +++ b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp @@ -79,6 +79,7 @@ void CLDeconvolutionLayerUpsampleKernel::configure(const CLCompileContext &compi // Perform validation step ARM_COMPUTE_ERROR_THROW_ON(CLDeconvolutionLayerUpsampleKernel::validate(input->info(), output->info(), info)); + auto padding_info = get_padding_info({ input, output }); _input = input; _output = output; @@ -98,6 +99,7 @@ void CLDeconvolutionLayerUpsampleKernel::configure(const CLCompileContext &compi output_access.set_valid_region(win, ValidRegion(Coordinates(), output->info()->tensor_shape())); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } void CLDeconvolutionLayerUpsampleKernel::run(const Window &window, cl::CommandQueue &queue) diff --git a/src/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.cpp b/src/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.cpp index ea22ec0067..ca7e9d4b23 100644 --- a/src/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.cpp +++ b/src/core/CL/kernels/CLDeconvolutionReshapeOutputKernel.cpp @@ -128,6 +128,7 @@ void CLDeconvolutionReshapeOutputKernel::configure(const CLCompileContext &compi ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, input_info, weights_info); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (bias != nullptr ? bias->info() : nullptr), output->info(), input_info, weights_info, deconv_info)); + auto padding_info = get_padding_info({ input, bias, output }); // Configure kernel window auto win_config = validate_and_configure_window(input->info(), output->info(), input_info, weights_info, deconv_info); ARM_COMPUTE_ERROR_THROW_ON(win_config.first); @@ -173,6 +174,7 @@ void CLDeconvolutionReshapeOutputKernel::configure(const CLCompileContext &compi _config_id += support::cpp11::to_string(output->info()->dimension(0)); _config_id += "_"; _config_id += support::cpp11::to_string(output->info()->dimension(1)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLDeconvolutionReshapeOutputKernel::validate(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const ITensorInfo *input_info, const ITensorInfo *weights_info, diff --git a/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp b/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp index 448f5a9c1e..22eee11c8a 100644 --- a/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp +++ b/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp @@ -81,6 +81,7 @@ void CLFFTDigitReverseKernel::configure(const ICLTensor *input, ICLTensor *outpu void CLFFTDigitReverseKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ICLTensor *idx, const FFTDigitReverseKernelInfo &config) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, idx); + auto padding_info = get_padding_info({ input, output, idx }); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), idx->info(), config)); _input = input; @@ -108,6 +109,7 @@ void CLFFTDigitReverseKernel::configure(const CLCompileContext &compile_context, _config_id += support::cpp11::to_string(input->info()->dimension(0)); _config_id += "_"; _config_id += support::cpp11::to_string(input->info()->dimension(1)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLFFTDigitReverseKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *idx, const FFTDigitReverseKernelInfo &config) diff --git a/src/core/CL/kernels/CLFFTRadixStageKernel.cpp b/src/core/CL/kernels/CLFFTRadixStageKernel.cpp index 68ccb5e8e6..5df8ca6025 100644 --- a/src/core/CL/kernels/CLFFTRadixStageKernel.cpp +++ b/src/core/CL/kernels/CLFFTRadixStageKernel.cpp @@ -92,6 +92,7 @@ void CLFFTRadixStageKernel::configure(const CLCompileContext &compile_context, I { ARM_COMPUTE_ERROR_ON_NULLPTR(input); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (output != nullptr) ? output->info() : nullptr, config)); + auto padding_info = get_padding_info({ input, output }); _input = input; _output = output; @@ -133,6 +134,7 @@ void CLFFTRadixStageKernel::configure(const CLCompileContext &compile_context, I _config_id += support::cpp11::to_string(input->info()->dimension(0)); _config_id += "_"; _config_id += support::cpp11::to_string(input->info()->dimension(1)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLFFTRadixStageKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const FFTRadixStageKernelInfo &config) diff --git a/src/core/CL/kernels/CLFFTScaleKernel.cpp b/src/core/CL/kernels/CLFFTScaleKernel.cpp index f82aeca34b..edcf5d5a5d 100644 --- a/src/core/CL/kernels/CLFFTScaleKernel.cpp +++ b/src/core/CL/kernels/CLFFTScaleKernel.cpp @@ -85,6 +85,7 @@ void CLFFTScaleKernel::configure(const CLCompileContext &compile_context, ICLTen { ARM_COMPUTE_ERROR_ON_NULLPTR(input); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (output != nullptr) ? output->info() : nullptr)); + auto padding_info = get_padding_info({ input, output }); _input = input; _output = output; @@ -116,6 +117,7 @@ void CLFFTScaleKernel::configure(const CLCompileContext &compile_context, ICLTen _config_id += support::cpp11::to_string(input->info()->dimension(0)); _config_id += "_"; _config_id += support::cpp11::to_string(input->info()->dimension(1)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLFFTScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const FFTScaleKernelInfo &config) diff --git a/src/core/CL/kernels/CLFillBorderKernel.cpp b/src/core/CL/kernels/CLFillBorderKernel.cpp index 5d77c291d7..840ed0ca2f 100644 --- a/src/core/CL/kernels/CLFillBorderKernel.cpp +++ b/src/core/CL/kernels/CLFillBorderKernel.cpp @@ -69,6 +69,7 @@ void CLFillBorderKernel::configure(const CLCompileContext &compile_context, ITen { ARM_COMPUTE_ERROR_ON(tensor == nullptr); ARM_COMPUTE_ERROR_ON(tensor->num_channels() != 1); + auto padding_info = get_padding_info({ tensor }); border_size.limit(tensor->padding()); @@ -166,6 +167,7 @@ void CLFillBorderKernel::configure(const CLCompileContext &compile_context, ITen _config_id += support::cpp11::to_string(tensor->dimension(1)); _config_id += "_"; _config_id += lower_string(string_from_border_mode(border_mode)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } void CLFillBorderKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) diff --git a/src/core/CL/kernels/CLGatherKernel.cpp b/src/core/CL/kernels/CLGatherKernel.cpp index 9e802c20fb..e33bc7afd7 100644 --- a/src/core/CL/kernels/CLGatherKernel.cpp +++ b/src/core/CL/kernels/CLGatherKernel.cpp @@ -86,6 +86,7 @@ void CLGatherKernel::configure(const ICLTensor *input, const ICLTensor *indices, void CLGatherKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *indices, ICLTensor *output, int axis) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, indices); + auto padding_info = get_padding_info({ input, output, indices }); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), indices->info(), output->info(), axis)); // Configure kernel window @@ -107,6 +108,7 @@ void CLGatherKernel::configure(const CLCompileContext &compile_context, const IC // Create kernel _kernel = create_kernel(compile_context, "gather", build_opts.options()); ICLKernel::configure_internal(win_config.second); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLGatherKernel::validate(const ITensorInfo *input, const ITensorInfo *indices, const ITensorInfo *output, int axis) diff --git a/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp b/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp index dd3faf50a2..988bb39d88 100644 --- a/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp +++ b/src/core/CL/kernels/CLGenerateProposalsLayerKernel.cpp @@ -80,6 +80,7 @@ void CLComputeAllAnchorsKernel::configure(const ICLTensor *anchors, ICLTensor *a void CLComputeAllAnchorsKernel::configure(const CLCompileContext &compile_context, const ICLTensor *anchors, ICLTensor *all_anchors, const ComputeAnchorsInfo &info) { ARM_COMPUTE_ERROR_ON_NULLPTR(anchors, all_anchors); + auto padding_info = get_padding_info({ anchors, all_anchors }); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(anchors->info(), all_anchors->info(), info)); // Metadata @@ -123,6 +124,7 @@ void CLComputeAllAnchorsKernel::configure(const CLCompileContext &compile_contex // compose the struct. Window win = calculate_max_window(*all_anchors->info(), Steps(info.values_per_roi())); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLComputeAllAnchorsKernel::validate(const ITensorInfo *anchors, const ITensorInfo *all_anchors, const ComputeAnchorsInfo &info) diff --git a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp index 4c3b404be7..f9e1cbec27 100644 --- a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp +++ b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp @@ -84,6 +84,7 @@ void CLInstanceNormalizationLayerKernel::configure(ICLTensor *input, ICLTensor * void CLInstanceNormalizationLayerKernel::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const InstanceNormalizationLayerKernelInfo &info) { ARM_COMPUTE_ERROR_ON_NULLPTR(input); + auto padding_info = get_padding_info({ input, output }); _input = input; _output = output == nullptr ? input : output; @@ -112,6 +113,7 @@ void CLInstanceNormalizationLayerKernel::configure(const CLCompileContext &compi auto win_config = validate_and_configure_window(_input->info(), _output->info()); ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config)); ICLKernel::configure_internal(std::get<1>(win_config)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLInstanceNormalizationLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info) diff --git a/src/core/CL/kernels/CLMaxUnpoolingLayerKernel.cpp b/src/core/CL/kernels/CLMaxUnpoolingLayerKernel.cpp index 2a1312af94..d0ac12dcd7 100644 --- a/src/core/CL/kernels/CLMaxUnpoolingLayerKernel.cpp +++ b/src/core/CL/kernels/CLMaxUnpoolingLayerKernel.cpp @@ -81,6 +81,7 @@ void CLMaxUnpoolingLayerKernel::configure(const CLCompileContext &compile_contex { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), pool_info, indices->info())); + auto padding_info = get_padding_info({ input, indices, output }); _input = input; _output = output; @@ -115,6 +116,7 @@ void CLMaxUnpoolingLayerKernel::configure(const CLCompileContext &compile_contex _config_id += support::cpp11::to_string(output->info()->dimension(2)); _config_id += "_"; _config_id += support::cpp11::to_string(output->info()->dimension(3)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLMaxUnpoolingLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *indices, const ITensorInfo *output, const PoolingLayerInfo &pool_info) diff --git a/src/core/CL/kernels/CLPermuteKernel.cpp b/src/core/CL/kernels/CLPermuteKernel.cpp index 4d289f28e6..07d83bddc2 100644 --- a/src/core/CL/kernels/CLPermuteKernel.cpp +++ b/src/core/CL/kernels/CLPermuteKernel.cpp @@ -28,8 +28,8 @@ #include "src/core/helpers/WindowHelpers.h" #include "support/StringSupport.h" -using namespace arm_compute; - +namespace arm_compute +{ CLPermuteKernel::CLPermuteKernel() : _input(nullptr), _output(nullptr), _perm() { @@ -76,6 +76,7 @@ void CLPermuteKernel::configure(const ICLTensor *input, ICLTensor *output, const void CLPermuteKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const PermutationVector &perm) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + auto padding_info = get_padding_info({ input, output }); const TensorShape output_shape = get_output_shape(input->info(), perm); // Output auto inizialitation if not yet initialized auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape)); @@ -107,6 +108,7 @@ void CLPermuteKernel::configure(const CLCompileContext &compile_context, const I output->info()->set_valid_region(ValidRegion(coord, output->info()->tensor_shape())); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLPermuteKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const PermutationVector &perm) @@ -140,3 +142,4 @@ void CLPermuteKernel::run(const Window &window, cl::CommandQueue &queue) } while(window.slide_window_slice_4D(slice_in) && window.slide_window_slice_4D(slice_out)); } +} // namespace arm_compute \ No newline at end of file diff --git a/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp b/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp index 3a66d084b9..ccc61783c4 100644 --- a/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp +++ b/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp @@ -88,6 +88,7 @@ CLQLSTMLayerNormalizationKernel::CLQLSTMLayerNormalizationKernel() void CLQLSTMLayerNormalizationKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ICLTensor *weight, const ICLTensor *bias) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, weight, bias, output); + auto padding_info = get_padding_info({ input, weight, bias, output }); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), weight->info(), bias->info())); @@ -129,6 +130,7 @@ void CLQLSTMLayerNormalizationKernel::configure(const CLCompileContext &compile_ _config_id += support::cpp11::to_string(input->info()->dimension(0)); _config_id += "_"; _config_id += support::cpp11::to_string(input->info()->dimension(1)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } void CLQLSTMLayerNormalizationKernel::configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *weight, const ICLTensor *bias) diff --git a/src/core/CL/kernels/CLReorgLayerKernel.cpp b/src/core/CL/kernels/CLReorgLayerKernel.cpp index 662c790ca2..01853450ee 100644 --- a/src/core/CL/kernels/CLReorgLayerKernel.cpp +++ b/src/core/CL/kernels/CLReorgLayerKernel.cpp @@ -79,6 +79,7 @@ void CLReorgLayerKernel::configure(const CLCompileContext &compile_context, cons { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), stride)); + auto padding_info = get_padding_info({ input, output }); _input = input; _output = output; @@ -114,6 +115,7 @@ void CLReorgLayerKernel::configure(const CLCompileContext &compile_context, cons _config_id += support::cpp11::to_string(input->info()->dimension(2)); _config_id += "_"; _config_id += support::cpp11::to_string(stride); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLReorgLayerKernel::validate(const arm_compute::ITensorInfo *input, const arm_compute::ITensorInfo *output, int32_t stride) diff --git a/src/core/CL/kernels/CLReverseKernel.cpp b/src/core/CL/kernels/CLReverseKernel.cpp index 9a876258e9..b3c9bcafd1 100644 --- a/src/core/CL/kernels/CLReverseKernel.cpp +++ b/src/core/CL/kernels/CLReverseKernel.cpp @@ -71,6 +71,7 @@ void CLReverseKernel::configure(const ICLTensor *input, ICLTensor *output, const void CLReverseKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, const ICLTensor *axis) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, axis); + auto padding_info = get_padding_info({ input, output, axis }); _input = input; _output = output; @@ -109,6 +110,7 @@ void CLReverseKernel::configure(const CLCompileContext &compile_context, const I _config_id += support::cpp11::to_string(input->info()->dimension(1)); _config_id += "_"; _config_id += support::cpp11::to_string(input->info()->dimension(2)); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLReverseKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *axis) diff --git a/src/core/CL/kernels/CLSpaceToBatchLayerKernel.cpp b/src/core/CL/kernels/CLSpaceToBatchLayerKernel.cpp index 7af0071025..57f7af488b 100644 --- a/src/core/CL/kernels/CLSpaceToBatchLayerKernel.cpp +++ b/src/core/CL/kernels/CLSpaceToBatchLayerKernel.cpp @@ -95,6 +95,7 @@ void CLSpaceToBatchLayerKernel::configure(const CLCompileContext &compile_contex { ARM_COMPUTE_ERROR_ON_NULLPTR(input, block_shape, paddings, output); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), block_shape->info(), paddings->info(), output->info())); + auto padding_info = get_padding_info({ input, block_shape, paddings, output }); _input = input; _block_shape = block_shape; @@ -120,6 +121,7 @@ void CLSpaceToBatchLayerKernel::configure(const CLCompileContext &compile_contex // Configure kernel window Window win = calculate_max_window(*output->info(), Steps()); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } void CLSpaceToBatchLayerKernel::configure(const ICLTensor *input, const int block_shape_x, const int block_shape_y, const Size2D &padding_left, const Size2D &padding_right, diff --git a/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp b/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp index 1c648e0944..4e5b417ec6 100644 --- a/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp +++ b/src/core/CL/kernels/CLSpaceToDepthLayerKernel.cpp @@ -76,6 +76,7 @@ void CLSpaceToDepthLayerKernel::configure(const ICLTensor *input, ICLTensor *out void CLSpaceToDepthLayerKernel::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output, int32_t block_shape) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + auto padding_info = get_padding_info({ input, output }); TensorShape output_shape = compute_space_to_depth_shape(input->info(), block_shape); auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type()); @@ -100,6 +101,7 @@ void CLSpaceToDepthLayerKernel::configure(const CLCompileContext &compile_contex // Configure kernel window Window win = calculate_max_window(*output->info(), Steps()); ICLKernel::configure_internal(win); + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLSpaceToDepthLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, int32_t block_shape) diff --git a/src/core/CL/kernels/CLStridedSliceKernel.cpp b/src/core/CL/kernels/CLStridedSliceKernel.cpp index c87fcb9765..75fd01df14 100644 --- a/src/core/CL/kernels/CLStridedSliceKernel.cpp +++ b/src/core/CL/kernels/CLStridedSliceKernel.cpp @@ -92,6 +92,7 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + auto padding_info = get_padding_info({ input, output }); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask)); const TensorShape &input_shape = input->tensor_shape(); @@ -160,6 +161,7 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co _config_id += "_"; _config_id += support::cpp11::to_string(final_strides[i]); } + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLStridedSliceKernel::validate(const ITensorInfo *input, const ITensorInfo *output, -- cgit v1.2.1