diff options
author | Frederick Liardet <frederick.liardet@arm.com> | 2021-04-22 21:13:21 +0100 |
---|---|---|
committer | frederick.liardet <frederick.liardet@arm.com> | 2021-06-15 11:24:53 +0000 |
commit | 36dff9f81e3a95aea19fcc7246a4896930a14bc6 (patch) | |
tree | 64f3194e806bb4a8a5e6f2f30c202295c5e853c6 /src/core/CL/kernels/CLRemapKernel.h | |
parent | ee301b384f4aeb697a5c249b8bb848d784146582 (diff) | |
download | ComputeLibrary-36dff9f81e3a95aea19fcc7246a4896930a14bc6.tar.gz |
Add NHWC support to CLRemap
Add NHWC support to CLRemap, also add relevant tests.
Partially resolves COMPMID-4335.
Change-Id: I119bea99be497fb85d5cd83a10f8d4e8e1f97f17
Signed-off-by: Freddie Liardet <frederick.liardet@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5773
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLRemapKernel.h')
-rw-r--r-- | src/core/CL/kernels/CLRemapKernel.h | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/src/core/CL/kernels/CLRemapKernel.h b/src/core/CL/kernels/CLRemapKernel.h index 8efcf091ed..1e3a4ad13f 100644 --- a/src/core/CL/kernels/CLRemapKernel.h +++ b/src/core/CL/kernels/CLRemapKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,6 +24,7 @@ #ifndef ARM_COMPUTE_CLREMAPKERNEL_H #define ARM_COMPUTE_CLREMAPKERNEL_H +#include "arm_compute/core/KernelDescriptors.h" #include "arm_compute/core/Types.h" #include "src/core/CL/ICLKernel.h" @@ -47,25 +48,36 @@ public: CLRemapKernel &operator=(CLRemapKernel &&) = default; /** Initialize the kernel's input, output and border mode. * - * @param[in] input Source tensor. Data types supported: U8. - * @param[in] map_x Map for X coordinates. Data types supported: F32. - * @param[in] map_y Map for Y coordinates. Data types supported: F32. - * @param[out] output Destination tensor. Data types supported: U8. All but the lowest two dimensions must be the same size as in the input tensor, i.e. remapping is only performed within the XY-plane. - * @param[in] policy The interpolation type. - * @param[in] border_undefined True if the border mode is undefined. False if it's replicate or constant. + * @param[in] compile_context The compile context to be used. + * @param[in] input Source tensor. Data types supported: U8. + * @param[in] map_x Map for X coordinates. Data types supported: F32. + * @param[in] map_y Map for Y coordinates. Data types supported: F32. + * @param[out] output Destination tensor. Data types supported: U8. All but the lowest two dimensions must be the same size as in the input tensor, i.e. remapping is only performed within the XY-plane. + * @param[in] info RemapInfo struct: + * - policy Interpolation policy to use. Only NEAREST and BILINEAR are supported. + * - border_mode Border mode to use on the input tensor. Only CONSTANT and UNDEFINED are supported. + * - constant_border_value Constant value to use for borders if border_mode is set to CONSTANT. */ - void configure(const ICLTensor *input, const ICLTensor *map_x, const ICLTensor *map_y, ICLTensor *output, InterpolationPolicy policy, bool border_undefined); - /** Initialize the kernel's input, output and border mode. + void configure(const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *map_x, const ICLTensor *map_y, ICLTensor *output, RemapInfo info); + /** Validate the kernel's input, output and border mode. + * + * @param[in] input Source tensor. Data types supported: U8. + * @param[in] map_x Map for X coordinates. Data types supported: F32. + * @param[in] map_y Map for Y coordinates. Data types supported: F32. + * @param[out] output Destination tensor. Data types supported: U8. All but the lowest two dimensions must be the same size as in the input tensor, i.e. remapping is only performed within the XY-plane. + * @param[in] info RemapInfo struct: + * - policy Interpolation policy to use. Only NEAREST and BILINEAR are supported. + * - border_mode Border mode to use on the input tensor. Only CONSTANT and UNDEFINED are supported. + * - constant_border_value Constant value to use for borders if border_mode is set to CONSTANT. + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *map_x, const ITensorInfo *map_y, ITensorInfo *output, RemapInfo info); + /** Function to set the constant value on fill border kernel depending on type. * - * @param[in] compile_context The compile context to be used. - * @param[in] input Source tensor. Data types supported: U8. - * @param[in] map_x Map for X coordinates. Data types supported: F32. - * @param[in] map_y Map for Y coordinates. Data types supported: F32. - * @param[out] output Destination tensor. Data types supported: U8. All but the lowest two dimensions must be the same size as in the input tensor, i.e. remapping is only performed within the XY-plane. - * @param[in] policy The interpolation type. - * @param[in] border_undefined True if the border mode is undefined. False if it's replicate or constant. + * @param[in] idx Index of the kernel argument to set. + * @param[in] constant_border_value Constant value to use for borders if border_mode is set to CONSTANT. */ - void configure(const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *map_x, const ICLTensor *map_y, ICLTensor *output, InterpolationPolicy policy, bool border_undefined); + template <class T> + void set_constant_border(unsigned int idx, const PixelValue &constant_border_value); // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; @@ -76,6 +88,7 @@ private: ICLTensor *_output; const ICLTensor *_map_x; const ICLTensor *_map_y; + DataLayout _data_layout; }; } // namespace arm_compute #endif /*ARM_COMPUTE_CLREMAPKERNEL_H */ |