47 auto k = std::make_unique<NEConvolution3x3Kernel>();
49 _kernel = std::move(k);
51 auto b = std::make_unique<NEFillBorderKernel>();
52 b->configure(input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
53 _border_handler = std::move(
b);
56 template <
unsigned int matrix_size>
59 template <
unsigned int matrix_size>
61 : _memory_group(
std::move(memory_manager)), _tmp(), _is_separable(false), _kernel_hor(), _kernel_vert(), _kernel(), _border_handler()
65 template <
unsigned int matrix_size>
67 uint8_t constant_border_value)
73 std::array<int16_t, matrix_size> conv_col{ { 0 } };
74 std::array<int16_t, matrix_size> conv_row{ { 0 } };
76 _is_separable =
separate_matrix(conv, conv_col.data(), conv_row.data(), matrix_size);
78 auto b = std::make_unique<NEFillBorderKernel>();
87 _memory_group.
manage(&_tmp);
95 _kernel_hor = std::make_unique<NESeparableConvolutionHorKernel<matrix_size>>();
96 _kernel_vert = std::make_unique<NESeparableConvolutionVertKernel<matrix_size>>();
103 b->configure(input, _kernel_hor->border_size(), border_mode,
PixelValue(constant_border_value));
107 _kernel = std::make_unique<NEConvolutionKernel<matrix_size>>();
109 b->configure(input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
111 _border_handler = std::move(b);
114 template <
unsigned int matrix_size>
141 auto k = std::make_unique<NEConvolutionRectangleKernel>();
142 k->configure(input, output, conv, rows, cols, scale,
false);
143 _kernel = std::move(k);
145 auto b = std::make_unique<NEFillBorderKernel>();
146 b->configure(input, _kernel->border_size(), border_mode,
PixelValue(constant_border_value));
147 _border_handler = std::move(
b);
BorderMode
Methods available to handle borders.
Class describing the value of a pixel for any image format.
void init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
Shares the same backing memory with another tensor allocator, while the tensor info might be differen...
~NEConvolutionRectangle()
Default destructor.
1 channel, 1 U8 per channel
NEConvolutionSquare(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
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.
~NEConvolution3x3()
Default destructor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
uint32_t calculate_matrix_scale(const int16_t *matrix, unsigned int matrix_size)
Calculate the scale of the given square matrix.
Interface for Neon tensor.
Copyright (c) 2017-2021 Arm Limited.
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
void configure(ITensor *input, ITensor *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.
void configure(ITensor *input, ITensor *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.
void run() override
Run the kernels contained in the function.
Basic function to execute convolution of size 5x5, 7x7, 9x9.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
~NEConvolutionSquare()
Default destructor.
1 channel, 1 S16 per channel
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Memory group resources scope handling class.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
void configure(ITensor *input, ITensor *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.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
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.
DataType
Available data types.
static IScheduler & get()
Access the scheduler singleton.