From 8893e454fa699f5dc33ff6b71f47e4c36fd1c1be Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Thu, 23 Mar 2023 12:06:45 +0000 Subject: Add cropping support to NEBatchToSpace - Deprecate dynamic block shape interface - Iterate over output window instead of input window for simpler implementation and better performance - Add cropping support and cropping tests Resolves COMPMID-5918 Signed-off-by: SiCong Li Change-Id: Ifea0f5f7760ffd0f4d5d4f3a5ae8d14d0b98b790 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9378 Reviewed-by: Viet-Hoa Do Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- arm_compute/core/utils/misc/ShapeCalculator.h | 2 +- arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'arm_compute') diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 916da1bd9d..9b1ebf63c2 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -1201,7 +1201,7 @@ inline TensorShape compute_split_shape(const ITensorInfo *input, unsigned int ax * * @return the calculated shape */ -inline TensorShape compute_space_to_batch_shape(const ITensorInfo *input, const int block_x, const int block_y, const Size2D &padding_left, const Size2D &padding_right) +inline TensorShape compute_space_to_batch_shape(const ITensorInfo *input, int block_x, int block_y, const Size2D &padding_left, const Size2D &padding_right) { TensorShape output_shape{ input->tensor_shape() }; diff --git a/arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h b/arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h index 92df8913ab..b33ba435a8 100644 --- a/arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h +++ b/arm_compute/runtime/NEON/functions/NEBatchToSpaceLayer.h @@ -64,16 +64,18 @@ public: * @param[in] input Tensor input. Supported tensor rank: 4. Data types supported: All. * @param[in] block_shape 1-D tensor with shape [M]. Data types supported: S32 * @param[out] output Tensor output. Data types supported: same as @p input - * @param[in] crop_info Information about how the output shape is cropped after batch to space is performed + * + * @deprecated This method for dynamic block shape is not fully mature and will be removed in 23.08 release */ - void configure(const ITensor *input, const ITensor *block_shape, ITensor *output, const CropInfo &crop_info = CropInfo{}); + ARM_COMPUTE_DEPRECATED_REL(23.05) + void configure(const ITensor *input, const ITensor *block_shape, ITensor *output); /** Set the input and output tensors. (Static block shape). * * @param[in] input Tensor input. Supported tensor rank: 4. Data types supported: All. * @param[in] block_shape_x Block shape x value. * @param[in] block_shape_y Block shape y value. * @param[out] output Tensor output. Data types supported: same as @p input - * @param[in] crop_info Information about how the output shape is cropped after batch to space is performed + * @param[in] crop_info Specifies how the output shape is cropped after batch to space is performed */ void configure(const ITensor *input, int32_t block_shape_x, int32_t block_shape_y, ITensor *output, const CropInfo &crop_info = CropInfo{}); /** Static function to check if given info will lead to a valid configuration of @ref CLBatchToSpaceLayer @@ -81,18 +83,19 @@ public: * @param[in] input Tensor input info. Supported tensor rank: 4. Data types supported: All. * @param[in] block_shape block shape tensor info with shape [M]. Data types supported: S32 * @param[out] output Tensor output info. Data types supported: same as @p input - * @param[in] crop_info Information about how the output shape is cropped after batch to space is performed * * @return a status + * @deprecated This method for dynamic block shape is not fully mature and will be removed in 23.08 release */ - static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output, const CropInfo &crop_info = CropInfo{}); + ARM_COMPUTE_DEPRECATED_REL(23.05) + static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output); /** Static function to check if given info will lead to a valid configuration of @ref CLBatchToSpaceLayer (Static block shape). * * @param[in] input Tensor input info. Supported tensor rank: 4. Data types supported: All. * @param[in] block_shape_x Block shape x value. * @param[in] block_shape_y Block shape y value. * @param[out] output Tensor output info. Data types supported: same as @p input - * @param[in] crop_info Information about how the output shape is cropped after batch to space is performed + * @param[in] crop_info Specifies how the output shape is cropped after batch to space is performed * * @return a status */ -- cgit v1.2.1