From b88272e2dcf09803cd275cfeb5ca1ea743a091ff Mon Sep 17 00:00:00 2001 From: SiCongLi Date: Wed, 24 Feb 2021 15:40:57 +0000 Subject: Remove usage of valid window region in NHWC CPU kernels - Part2 Remove set_valid_region methods from all NHWC CPU ML functions / operators / kernels Resolves COMPMID-4152 (2/2) Change-Id: If9725e9c5b0213b87db96675e81b7fb724970b98 Signed-off-by: SiCongLi Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5203 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- src/core/cpu/kernels/CpuActivationKernel.cpp | 4 ---- src/core/cpu/kernels/CpuConcatenateBatchKernel.cpp | 5 +---- src/core/cpu/kernels/CpuConcatenateDepthKernel.cpp | 6 +----- src/core/cpu/kernels/CpuConcatenateHeightKernel.cpp | 5 +---- src/core/cpu/kernels/CpuConcatenateWidthKernel.cpp | 6 ++---- src/core/cpu/kernels/CpuFloorKernel.cpp | 4 ---- src/core/cpu/kernels/CpuPermuteKernel.cpp | 3 --- src/core/cpu/kernels/CpuPoolingKernel.cpp | 5 +---- src/core/cpu/kernels/CpuReshapeKernel.cpp | 4 +--- src/core/cpu/kernels/CpuSoftmaxKernel.cpp | 10 ++-------- 10 files changed, 9 insertions(+), 43 deletions(-) (limited to 'src/core/cpu') diff --git a/src/core/cpu/kernels/CpuActivationKernel.cpp b/src/core/cpu/kernels/CpuActivationKernel.cpp index efdb42b8a5..761258941d 100644 --- a/src/core/cpu/kernels/CpuActivationKernel.cpp +++ b/src/core/cpu/kernels/CpuActivationKernel.cpp @@ -197,10 +197,6 @@ std::pair validate_and_configure_window(const ITensorInfo *src, { // dst auto inizialitation if not yet initialized auto_init_if_empty(*dst, *src->clone()); - - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); } return std::make_pair(Status{}, win); diff --git a/src/core/cpu/kernels/CpuConcatenateBatchKernel.cpp b/src/core/cpu/kernels/CpuConcatenateBatchKernel.cpp index 48eac13041..bd6d777572 100644 --- a/src/core/cpu/kernels/CpuConcatenateBatchKernel.cpp +++ b/src/core/cpu/kernels/CpuConcatenateBatchKernel.cpp @@ -183,10 +183,7 @@ void CpuConcatenateBatchKernel::configure(const ITensorInfo *src, unsigned int b } // Configure kernel window - Window win = calculate_max_window(*dst, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*dst, Steps()); ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuConcatenateDepthKernel.cpp b/src/core/cpu/kernels/CpuConcatenateDepthKernel.cpp index f64c282ae4..d8eed44cd8 100644 --- a/src/core/cpu/kernels/CpuConcatenateDepthKernel.cpp +++ b/src/core/cpu/kernels/CpuConcatenateDepthKernel.cpp @@ -179,11 +179,7 @@ void CpuConcatenateDepthKernel::configure(const ITensorInfo *src, unsigned int d } // Configure kernel window - Window win = calculate_max_window(*dst, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*dst, Steps()); ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuConcatenateHeightKernel.cpp b/src/core/cpu/kernels/CpuConcatenateHeightKernel.cpp index c6e224970a..4dc458a4a8 100644 --- a/src/core/cpu/kernels/CpuConcatenateHeightKernel.cpp +++ b/src/core/cpu/kernels/CpuConcatenateHeightKernel.cpp @@ -77,10 +77,7 @@ void CpuConcatenateHeightKernel::configure(const ITensorInfo *src, unsigned int _height_offset = height_offset; // Configure kernel window - Window win = calculate_max_window(*dst, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*dst, Steps()); ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuConcatenateWidthKernel.cpp b/src/core/cpu/kernels/CpuConcatenateWidthKernel.cpp index e707e8d5a4..efefd5d011 100644 --- a/src/core/cpu/kernels/CpuConcatenateWidthKernel.cpp +++ b/src/core/cpu/kernels/CpuConcatenateWidthKernel.cpp @@ -72,14 +72,12 @@ void CpuConcatenateWidthKernel::configure(const ITensorInfo *src, unsigned int w { ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, width_offset, dst)); + ARM_COMPUTE_UNUSED(dst); _width_offset = width_offset; // Configure kernel window - Window win = calculate_max_window(*src, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*src, Steps()); ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuFloorKernel.cpp b/src/core/cpu/kernels/CpuFloorKernel.cpp index 6115b69907..c2e9d48ce9 100644 --- a/src/core/cpu/kernels/CpuFloorKernel.cpp +++ b/src/core/cpu/kernels/CpuFloorKernel.cpp @@ -120,10 +120,6 @@ void CpuFloorKernel::configure(const ITensorInfo *src, ITensorInfo *dst) // Configure kernel window const Window win = calculate_max_window(*src, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); - ICPPKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuPermuteKernel.cpp b/src/core/cpu/kernels/CpuPermuteKernel.cpp index e3055f5f4f..7fd38a3ee7 100644 --- a/src/core/cpu/kernels/CpuPermuteKernel.cpp +++ b/src/core/cpu/kernels/CpuPermuteKernel.cpp @@ -256,9 +256,6 @@ void CpuPermuteKernel::configure(const ITensorInfo *src, ITensorInfo *dst, const Window win = calculate_max_window(*src, Steps()); // The NEPermute doesn't need padding so update_window_and_padding() can be skipped - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuPoolingKernel.cpp b/src/core/cpu/kernels/CpuPoolingKernel.cpp index e159bb40a9..115a3a4c67 100644 --- a/src/core/cpu/kernels/CpuPoolingKernel.cpp +++ b/src/core/cpu/kernels/CpuPoolingKernel.cpp @@ -422,10 +422,7 @@ void CpuPoolingKernel::configure(ITensorInfo *src, ITensorInfo *dst, const Pooli if(_data_layout == DataLayout::NHWC) { // Configure kernel window - Window win = calculate_max_window(*dst, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*dst, Steps()); ICpuKernel::configure(win); } else diff --git a/src/core/cpu/kernels/CpuReshapeKernel.cpp b/src/core/cpu/kernels/CpuReshapeKernel.cpp index 41ff8bd390..4ab1612518 100644 --- a/src/core/cpu/kernels/CpuReshapeKernel.cpp +++ b/src/core/cpu/kernels/CpuReshapeKernel.cpp @@ -82,13 +82,11 @@ void CpuReshapeKernel::configure(const ITensorInfo *src, ITensorInfo *dst) { ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, dst)); + ARM_COMPUTE_UNUSED(dst); // Configure kernel window Window win = calculate_max_window(*src); - // Set the destination valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ICpuKernel::configure(win); } diff --git a/src/core/cpu/kernels/CpuSoftmaxKernel.cpp b/src/core/cpu/kernels/CpuSoftmaxKernel.cpp index a8542b6be1..d2453ed21d 100644 --- a/src/core/cpu/kernels/CpuSoftmaxKernel.cpp +++ b/src/core/cpu/kernels/CpuSoftmaxKernel.cpp @@ -228,10 +228,7 @@ void CpuLogits1DMaxKernel::configure(const ITensorInfo *src, ITensorInfo *dst) // Output auto initialization if not yet initialized auto_init_if_empty(*dst, output_shape, 1, src->data_type(), src->quantization_info()); - Window win = calculate_max_window(*src, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*src, Steps()); ICpuKernel::configure(win); } @@ -330,10 +327,7 @@ void CpuLogits1DSoftmaxKernel::configure(const ITensorInfo *src, const I auto_init_if_empty(*tmp, TensorInfo(*src).set_data_type(tmp_data_type).reset_padding()); // Configure kernel window - Window win = calculate_max_window(*max, Steps()); - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + Window win = calculate_max_window(*max, Steps()); ICpuKernel::configure(win); } -- cgit v1.2.1