From 995f55252dfaaa5b64075b96272ae11e23d6ca9b Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Mon, 29 Jan 2018 13:43:35 +0000 Subject: COMPMID-864 Window::collapse_if_possible() is misused in several CL kernels Removed unnecessary collapse_if_possible() calls. Change-Id: I6f3434bc4a26470c4de5bac4e3d90b4b019c2c9c Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/117993 Reviewed-by: Michalis Spyrou Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/CL/kernels/CLQuantizationLayerKernel.h | 6 +++--- arm_compute/core/Window.h | 10 ++++++++++ arm_compute/core/Window.inl | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'arm_compute/core') diff --git a/arm_compute/core/CL/kernels/CLQuantizationLayerKernel.h b/arm_compute/core/CL/kernels/CLQuantizationLayerKernel.h index 13092400c7..a24ddb1a3a 100644 --- a/arm_compute/core/CL/kernels/CLQuantizationLayerKernel.h +++ b/arm_compute/core/CL/kernels/CLQuantizationLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -51,8 +51,8 @@ public: ~CLQuantizationLayerKernel() = default; /** Set the input, output, min and max. * - * @param[in] input Source tensor. Data types supported: F32. - * @param[out] output Destination tensor. Data types supported: U8. + * @param[in] input Source tensor with at least 3 dimensions. The dimensions over the third will be interpreted as batches. Data types supported: F32. + * @param[out] output Destination tensor with the same dimensions of input. Output data type must be U8. * @param[in] min_max Pointer to the tensor with shape [2, batches] which stores the minimum and maximum value for each 3D input tensor. * The dimensions over the second must match the batched dimensions of the input tensor. Data type supported: F32. */ diff --git a/arm_compute/core/Window.h b/arm_compute/core/Window.h index cca12c9efe..5ca210a112 100644 --- a/arm_compute/core/Window.h +++ b/arm_compute/core/Window.h @@ -177,6 +177,16 @@ public: */ void shift(size_t dimension, int shift_value); + /** Shift down all the dimensions of a window + * + * i.e new_dims[n] = old_dims[n+shift_value]. + * + * @param[in] shift_value Number of dimensions to shift the window by. + * + * @return The window with the shifted dimensions. + */ + Window shift_dimensions(unsigned int shift_value) const; + /** Adjust the start or end of a given dimension by the given value * * @param[in] dimension The dimension to adjust diff --git a/arm_compute/core/Window.inl b/arm_compute/core/Window.inl index 23b2a8e322..18d454a0cb 100644 --- a/arm_compute/core/Window.inl +++ b/arm_compute/core/Window.inl @@ -77,6 +77,16 @@ inline Window Window::collapse_if_possible(const Window &full_window, const size return collapsed; } +inline Window Window::shift_dimensions(unsigned int shift_value) const +{ + Window shifted_window; + for(size_t n = 0; n < (Coordinates::num_max_dimensions - shift_value); n++) + { + shifted_window.set(n, _dims[n + shift_value]); + } + return shifted_window; +} + inline Window Window::collapse(const Window &full_window, const size_t first, const size_t last) const { bool has_collapsed = false; -- cgit v1.2.1