47 uint8_t constant_border_value)
49 auto k = std::make_unique<CLConvolution3x3Kernel>();
51 _kernel = std::move(k);
52 _border_handler->configure(compile_context, input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
55 template <
unsigned int matrix_size>
62 template <
unsigned int matrix_size>
65 template <
unsigned int matrix_size>
67 uint8_t constant_border_value)
72 template <
unsigned int matrix_size>
74 uint8_t constant_border_value)
78 std::array<int16_t, matrix_size> conv_col{ 0 };
79 std::array<int16_t, matrix_size> conv_row{ 0 };
80 _is_separable =
separate_matrix(conv, conv_col.data(), conv_row.data(), matrix_size);
88 _memory_group.
manage(&_tmp);
95 _kernel_hor->configure(compile_context, input, &_tmp, conv_row.data(), border_mode ==
BorderMode::UNDEFINED);
96 _kernel_vert->configure(compile_context, &_tmp, output, conv_col.data(),
scale, border_mode ==
BorderMode::UNDEFINED, type_pair.second);
97 _border_handler->configure(compile_context, input, _kernel_hor->border_size(), border_mode,
PixelValue(constant_border_value));
104 _kernel->configure(compile_context, input, output, conv, scale, border_mode ==
BorderMode::UNDEFINED);
105 _border_handler->configure(compile_context, input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
109 template <
unsigned int matrix_size>
137 BorderMode border_mode, uint8_t constant_border_value)
140 auto k = std::make_unique<CLConvolutionRectangleKernel>();
141 k->configure(compile_context, input, output, conv, rows, cols, scale,
false);
142 _kernel = std::move(k);
143 _border_handler->configure(compile_context, input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
BorderMode
Methods available to handle borders.
Class describing the value of a pixel for any image format.
void configure(ICLTensor *input, ICLTensor *output, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value=0)
Initialize the function's source, destination, conv and border_mode.
Kernel for the Horizontal pass of a Separable Convolution.
static CLScheduler & get()
Access the scheduler singleton.
CLConvolutionSquare(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
1 channel, 1 U8 per channel
std::pair< DataType, DataType > data_type_for_convolution(const int16_t *conv_col, const int16_t *conv_row, size_t size)
Calculate accurary required by the horizontal and vertical convolution computations.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
~CLConvolutionSquare()
Default destructor.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
uint32_t calculate_matrix_scale(const int16_t *matrix, unsigned int matrix_size)
Calculate the scale of the given square matrix.
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
Copyright (c) 2017-2021 Arm Limited.
void run() override
Run the kernels contained in the function.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void configure(ICLTensor *input, ICLTensor *output, const int16_t *conv, uint32_t rows, uint32_t cols, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value=0)
Initialize the function's source, destination, conv and border_mode.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Interface for the kernel to run an arbitrary size convolution on a tensor.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Kernel for the Vertical pass of a Separable Convolution.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
Basic function to execute square convolution.Currently it supports 5x5, 7x7, 9x9. ...
Interface for filling the border of a kernel.
Memory group resources scope handling class.
Interface for OpenCL tensor.
void configure(ICLTensor *input, ICLTensor *output, const int16_t *conv, uint32_t scale, BorderMode border_mode, uint8_t constant_border_value=0)
Initialize the function's source, destination, conv and border_mode.
Borders are left undefined.
Store the tensor's metadata.
bool separate_matrix(const int16_t *conv, int16_t *conv_col, int16_t *conv_row, uint8_t size)
Separate a 2D convolution into two 1D convolutions.