38 : _input(nullptr), _output(nullptr), _map_x(nullptr), _map_y(nullptr), _data_layout(
DataLayout::
NCHW)
52 constant_border_value.
get(value);
53 ICLKernel::add_argument<T>(idx,
static_cast<T
>(value));
93 build_opts.
add_option_if(is_constant_border,
"-DCONSTANT_BORDER");
111 const int total_right =
ceil_to_multiple(input_width, num_elems_processed_per_iteration);
120 ICLKernel::configure_internal(win);
126 if(is_nhwc && is_constant_border)
134 static_assert(
sizeof(cl_half) ==
sizeof(
half),
"Half must be same size as cl_half");
135 static_assert(
sizeof(cl_half) == 2,
"Half must be 16 bit");
155 unsigned int idx = 0;
171 unsigned int idx = 0;
Window first_slice_window_2D() const
First 2D slice of the window.
unsigned int top
top of the border
Class describing the value of a pixel for any image format.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
void configure(const CLCompileContext &compile_context, const ICLTensor *input, const ICLTensor *map_x, const ICLTensor *map_y, ICLTensor *output, RemapInfo info)
Initialize the kernel's input, output and border mode.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Container for 2D border size.
void enqueue(cl::CommandQueue &queue, ICLKernel &kernel, const Window &window, const cl::NDRange &lws_hint=CLKernelLibrary::get().default_ndrange(), bool use_dummy_work_items=false)
Add the kernel to the command queue with the given window.
const StringSet & options() const
Gets the current options list set.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
static Status validate(const ITensorInfo *input, const ITensorInfo *map_x, const ITensorInfo *map_y, const ITensorInfo *output, RemapInfo info)
Checks if the kernel's input, output and border mode will lead to a valid configuration of CLRemapKer...
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
1 channel, 1 U8 per channel
void get(uint8_t &v) const
Interpret the pixel value as a U8.
std::string to_string(T &&value)
Convert integer and float values to string.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
PixelValue constant_border_value
half_float::half half
16-bit floating point type
1 channel, 1 F32 per channel
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
unsigned int bottom
bottom of the border
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
std::string lower_string(const std::string &val)
Lower a given string.
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
Implementation of a static rectangular access pattern.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
void add_option(std::string option)
Adds option to the existing build option list.
Window collapse(const Window &full_window, size_t first, size_t last=Coordinates::num_max_dimensions) const
Collapse the dimensions between first and last.
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
Creates an opencl kernel using a compile context.
InterpolationPolicy policy
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Class to describe a number of elements in each dimension.
Implementation of a row access pattern.
const std::string & string_from_interpolation_policy(InterpolationPolicy policy)
Translates a given interpolation policy to a string.
unsigned int num_elems_processed_per_iteration
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
void add_option_if(bool cond, std::string option)
Adds option if a given condition is true;.
static constexpr unsigned int num_arguments_per_2D_tensor()
Returns the number of arguments enqueued per 2D tensor object.
static constexpr unsigned int num_arguments_per_4D_tensor()
Returns the number of arguments enqueued per 4D tensor object.
unsigned int left
left of the border
Elementeise CL kernel type.
unsigned int right
right of the border
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
Num samples, channels, height, width.
CLRemapKernel()
Default constructor.
void set_constant_border(unsigned int idx, const PixelValue &constant_border_value)
Function to set the constant value on fill border kernel depending on type.
void add_2D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx...
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Interface for OpenCL tensor.
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Borders are left undefined.
Num samples, height, width, channels.
const size_t input_height
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Window first_slice_window_4D() const
First 4D slice of the window.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
BorderSize border_size() const override
The size of the border for that kernel.
void add_4D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 4D tensor's parameters to the object's kernel's arguments starting from the index idx...
DataLayout
[DataLayout enum definition]
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.