Georgios Pinitas | 77589b5 | 2018-08-21 14:41:35 +0100 | [diff] [blame] | 1 | /* |
Manuel Bottini | 10c53f1 | 2019-07-17 16:11:53 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 ARM Limited. |
Georgios Pinitas | 77589b5 | 2018-08-21 14:41:35 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #ifndef __ARM_COMPUTE_CL_STRIDED_SLICE_H__ |
| 25 | #define __ARM_COMPUTE_CL_STRIDED_SLICE_H__ |
| 26 | |
| 27 | #include "arm_compute/runtime/CL/ICLSimpleFunction.h" |
| 28 | |
| 29 | namespace arm_compute |
| 30 | { |
| 31 | // Forward Declarations |
| 32 | class ICLTensor; |
| 33 | |
| 34 | /** Basic function to run @ref CLStridedSliceKernel */ |
| 35 | class CLStridedSlice : public ICLSimpleFunction |
| 36 | { |
| 37 | public: |
| 38 | /** Configure kernel |
| 39 | * |
| 40 | * @note Supported tensor rank: up to 4 |
| 41 | * |
Michele Di Giorgio | 6b612f5 | 2019-09-05 12:30:22 +0100 | [diff] [blame] | 42 | * @param[in] input Source tensor. Data type supported: U8/S8/QASYMM8/U16/S16/QASYMM16/QSYMM16/U32/S32/F16/F32 |
Georgios Pinitas | 77589b5 | 2018-08-21 14:41:35 +0100 | [diff] [blame] | 43 | * @param[out] output Destination tensor. Data type supported: Same as @p input |
| 44 | * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 45 | * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 46 | * @param[in] strides The strides of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 47 | * @param[in] begin_mask (Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead. |
| 48 | * @param[in] end_mask (Optional) If the ith bit of end_mask is set, ends[i] is ignored and the fullest possible range in that dimension is used instead. |
| 49 | * @param[in] shrink_axis_mask (Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. |
| 50 | * A slice of size 1 starting from starts[i] in the dimension must be preserved. |
| 51 | */ |
| 52 | void configure(const ICLTensor *input, ICLTensor *output, |
| 53 | const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, |
| 54 | int32_t begin_mask = 0, int32_t end_mask = 0, int32_t shrink_axis_mask = 0); |
| 55 | |
| 56 | /** Static function to check if given info will lead to a valid configuration of @ref CLStridedSlice |
| 57 | * |
| 58 | * @note Supported tensor rank: up to 4 |
| 59 | * |
Michele Di Giorgio | 6b612f5 | 2019-09-05 12:30:22 +0100 | [diff] [blame] | 60 | * @param[in] input Source tensor. Data type supported: U8/S8/QASYMM8/U16/S16/QASYMM16/QSYMM16/U32/S32/F16/F32 |
Georgios Pinitas | 77589b5 | 2018-08-21 14:41:35 +0100 | [diff] [blame] | 61 | * @param[in] output Destination tensor. Data type supported: Same as @p input |
| 62 | * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 63 | * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 64 | * @param[in] strides The strides of the dimensions of the input tensor to be sliced. The length must be of rank(input). |
| 65 | * @param[in] begin_mask (Optional) If the ith bit of begin_mask is set, starts[i] is ignored and the fullest possible range in that dimension is used instead. |
| 66 | * @param[in] end_mask (Optional) If the ith bit of end_mask is set, ends[i] is ignored and the fullest possible range in that dimension is used instead. |
| 67 | * @param[in] shrink_axis_mask (Optional) If the ith bit of shrink_axis_mask is set, it implies that the ith specification shrinks the dimensionality by 1. |
| 68 | * A slice of size 1 starting from starts[i] in the dimension must be preserved. |
| 69 | */ |
| 70 | static Status validate(const ITensorInfo *input, const ITensorInfo *output, |
| 71 | const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, |
| 72 | int32_t begin_mask = 0, int32_t end_mask = 0, int32_t shrink_axis_mask = 0); |
| 73 | }; |
| 74 | } // namespace arm_compute |
| 75 | #endif /* __ARM_COMPUTE_CL_STRIDED_SLICE_H__ */ |