From 702dc0c71f2b2830b63e3b4079ede0ef76377f0a Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Fri, 19 Mar 2021 15:06:07 +0000 Subject: Remove usage of valid window region CL - NHWC Resolves: COMPMID-4153 Change-Id: Ib0d60c9acaac8aaf3946c62fc2d740b5ec6cee5c Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5301 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- src/core/CL/kernels/CLStridedSliceKernel.cpp | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'src/core/CL/kernels/CLStridedSliceKernel.cpp') diff --git a/src/core/CL/kernels/CLStridedSliceKernel.cpp b/src/core/CL/kernels/CLStridedSliceKernel.cpp index 75fd01df14..dd51df9363 100644 --- a/src/core/CL/kernels/CLStridedSliceKernel.cpp +++ b/src/core/CL/kernels/CLStridedSliceKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -68,23 +68,6 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, return Status{}; } - -std::pair validate_and_configure_window(const ITensorInfo *input, ITensorInfo *output, - const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, - int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask) -{ - // Output tensor auto initialization if not yet initialized - const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_strided_slice_shape(*input, - starts, ends, strides, - begin_mask, end_mask, shrink_axis_mask); - auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape)); - - // Create window - Window win = calculate_max_window(*output, Steps()); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); - - return std::make_pair(Status{}, win); -} } // namespace void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output, @@ -106,8 +89,11 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co begin_mask, end_mask, shrink_axis_mask); // Configure kernel window - auto win_config = validate_and_configure_window(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask); - ARM_COMPUTE_ERROR_THROW_ON(win_config.first); + const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_strided_slice_shape(*input, + starts, ends, strides, + begin_mask, end_mask, shrink_axis_mask); + auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape)); + Window win = calculate_max_window(*output, Steps()); // Enable multiple elements processing along x if stride_x is 1 and output width greater than the access vector size const int vec_size_x = 16 / input->element_size(); @@ -118,11 +104,11 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co // Update window if needed if(multi_access_x) { - Window &updated_window = std::get<1>(win_config); + Window &updated_window = win; updated_window.set(Window::DimX, Window::Dimension(updated_window.x().start(), ceil_to_multiple(updated_window.x().end(), vec_size_x), vec_size_x)); } - ICLKernel::configure_internal(win_config.second); + ICLKernel::configure_internal(win); // Create build options CLBuildOptions build_opts; @@ -169,9 +155,6 @@ Status CLStridedSliceKernel::validate(const ITensorInfo *input, const ITensorInf int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask) { ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask)); - ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), - starts, ends, strides, begin_mask, end_mask, shrink_axis_mask) - .first); return Status{}; } -- cgit v1.2.1