diff options
Diffstat (limited to 'src/core/NEON/kernels/NEGatherKernel.h')
-rw-r--r-- | src/core/NEON/kernels/NEGatherKernel.h | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/core/NEON/kernels/NEGatherKernel.h b/src/core/NEON/kernels/NEGatherKernel.h index 46b41b28e3..b8c069f99e 100644 --- a/src/core/NEON/kernels/NEGatherKernel.h +++ b/src/core/NEON/kernels/NEGatherKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Arm Limited. + * Copyright (c) 2019-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,6 +26,7 @@ #define ARM_COMPUTE_NEGATHERKERNEL_H #include "arm_compute/core/Types.h" + #include "src/core/NEON/INEKernel.h" namespace arm_compute @@ -33,7 +34,7 @@ namespace arm_compute // Forward declarations class ITensor; -/** Kernel to perform other operation on Neon */ +/** Kernel to perform gather operation. */ class NEGatherKernel : public INEKernel { public: @@ -61,17 +62,17 @@ public: /** Initialise the kernel's inputs and outputs * * @param[in] input Source tensor. Supported tensor rank: up to 4. Data type supported: All - * @param[in] indices Indices tensor. Supported tensor rank: up to 1. Must be one of the following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) + * @param[in] indices Indices tensor. Supported tensor rank: up to 3. Must be one of the following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) + * @note 2D or 3D indices are only supported for the axis 1. * @param[out] output Destination tensor. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative values wrap around. Defaults to 0 + * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative values wrap around. Defaults to 0. + * */ void configure(const ITensor *input, const ITensor *indices, ITensor *output, int axis = 0); - /** Static function to check if given info will lead to a valid configuration of @ref NEGatherKernel + + /** Static function to check if given info will lead to a valid configuration * - * @param[in] input Source tensor info. Supported tensor rank: up to 4. Data type supported: All - * @param[in] indices Indices tensor info. Supported tensor rank: up to 1. Must be one of the following type: U32/S32. Each value Must be in range [0, input.shape[@p axis]) - * @param[in] output Destination tensor info. Data type supported: Same as @p input - * @param[in] axis (Optional) The axis in @p input to gather @p indices from. Negative values wrap around. Defaults to 0 + * Similar to @ref NEGatherKernel::configure() * * @return a status */ @@ -81,25 +82,8 @@ public: void run(const Window &window, const ThreadInfo &info) override; private: - /** Implementation of the gather operation for 0 axis. - * - * For gather on the 0 axis an element by element copy is performed. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> - void gather_0_axis(const Window &window, const ThreadInfo &info); - - /** Implementation of the gather operation. - * - * For 1<=axis a row-wise copy is taking place. - * - * @param[in] window Region on which to execute the kernel. (Must be a region of the window returned by window()) - * @param[in] info Info about executing thread and CPU. - */ - template <typename U> - void gather_n_axis(const Window &window, const ThreadInfo &info); + template <typename TIndex> + void gather_common(const Window &window, const ThreadInfo &info); using kernel_ptr = void (NEGatherKernel::*)(const Window &window, const ThreadInfo &info); @@ -108,6 +92,9 @@ private: int _axis; ITensor *_output; kernel_ptr _func; + + Strides _src_it_strides; + Strides _idx_it_strides; }; } // namespace arm_compute #endif /* ARM_COMPUTE_NEGATHERKERNEL_H */ |