21.02
|
Interface for the im2col reshape kernel. More...
#include <NEIm2ColKernel.h>
Public Member Functions | |
const char * | name () const override |
Name of the kernel. More... | |
NEIm2ColKernel () | |
Default constructor. More... | |
NEIm2ColKernel (const NEIm2ColKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEIm2ColKernel & | operator= (const NEIm2ColKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEIm2ColKernel (NEIm2ColKernel &&)=default | |
Allow instances of this class to be moved. More... | |
NEIm2ColKernel & | operator= (NEIm2ColKernel &&)=default |
Allow instances of this class to be moved. More... | |
~NEIm2ColKernel ()=default | |
Default destructor. More... | |
void | configure (const ITensor *input, ITensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation=Size2D(1U, 1U), unsigned int num_groups=1) |
Set the input and output of the kernel. More... | |
void | run (const Window &window, const ThreadInfo &info) override |
Execute the kernel on the passed window. More... | |
Public Member Functions inherited from ICPPKernel | |
virtual | ~ICPPKernel ()=default |
Default destructor. More... | |
virtual void | run_nd (const Window &window, const ThreadInfo &info, const Window &thread_locator) |
legacy compatibility layer for implemantions which do not support thread_locator In these cases we simply narrow the interface down the legacy version More... | |
virtual void | run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) |
Execute the kernel on the passed window. More... | |
Public Member Functions inherited from IKernel | |
IKernel () | |
Constructor. More... | |
virtual | ~IKernel ()=default |
Destructor. More... | |
virtual bool | is_parallelisable () const |
Indicates whether or not the kernel is parallelisable. More... | |
virtual BorderSize | border_size () const |
The size of the border for that kernel. More... | |
const Window & | window () const |
The maximum window the kernel can be executed on. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation=Size2D(1U, 1U), unsigned int num_groups=1) |
Static function to check if given info will lead to a valid configuration of NEIm2ColKernel. More... | |
Interface for the im2col reshape kernel.
Rearranges image blocks into columns. It is used to strip out each convolution block to a single column. It is used to transform a convolution to a plain matrix multiplication.
For example taking into account the image below and assuming 3x3 image blocks with stride of 1 we have:
\[ \left( \begin{array}{cccc} a00 & a01 & a02 & a03 \\ a10 & a11 & a12 & a13 \\ a20 & a21 & a22 & a23 \\ a30 & a31 & a32 & a33 \\ \end{array} \right) \rightarrow \left( \begin{array}{ccccccccc} a00 & a01 & a02 & a10 & a11 & a12 & a20 & a21 & a22 \\ a01 & a02 & a03 & a11 & a12 & a13 & a21 & a22 & a23 \\ a10 & a11 & a12 & a20 & a21 & a22 & a30 & a31 & a32 \\ a11 & a12 & a13 & a21 & a22 & a23 & a31 & a32 & a33 \\ \end{array} \right) \]
Definition at line 57 of file NEIm2ColKernel.h.
NEIm2ColKernel | ( | ) |
Default constructor.
Definition at line 358 of file NEIm2ColKernel.cpp.
Referenced by NEIm2ColKernel::name().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
default |
Default destructor.
Referenced by NEIm2ColKernel::name().
void configure | ( | const ITensor * | input, |
ITensor * | output, | ||
const Size2D & | kernel_dims, | ||
const PadStrideInfo & | conv_info, | ||
bool | has_bias, | ||
const Size2D & | dilation = Size2D(1U, 1U) , |
||
unsigned int | num_groups = 1 |
||
) |
Set the input and output of the kernel.
[in] | input | The input tensor to convert. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: QASYMM8/QASYMM8_SIGNED/BFLOAT16/F16/F32 Note: QASYMM8/QASYMM8_SIGNED works only for has_bias = false |
[out] | output | The output tensor. Data types supported: Same as input |
[in] | kernel_dims | The kernel dimensions (width and height). |
[in] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | has_bias | In case biases are provided expands the matrix with 1. |
[in] | dilation | (Optional) Dilation, in elements, across x and y. Defaults to (1, 1). |
[in] | num_groups | (Optional) Number of groups when performing a grouped convolution. num_groups != 1 is not supported |
Definition at line 363 of file NEIm2ColKernel.cpp.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_UNUSED, arm_compute::BFLOAT16, arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), ITensorInfo::data_type(), ITensorInfo::dimension(), arm_compute::F16, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::test::validation::has_bias, Size2D::height, arm_compute::HEIGHT, ITensor::info(), arm_compute::test::validation::input, arm_compute::NCHW, arm_compute::test::validation::num_groups, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::scaled_dimensions(), arm_compute::validate_arguments(), Size2D::width, and arm_compute::WIDTH.
Referenced by NEIm2ColKernel::name().
|
inlineoverridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 60 of file NEIm2ColKernel.h.
References NEIm2ColKernel::configure(), arm_compute::test::validation::conv_info, arm_compute::test::validation::has_bias, arm_compute::test::validation::info, arm_compute::test::validation::input, NEIm2ColKernel::NEIm2ColKernel(), arm_compute::test::validation::num_groups, NEIm2ColKernel::operator=(), NEIm2ColKernel::run(), arm_compute::U, NEIm2ColKernel::validate(), IKernel::window(), and NEIm2ColKernel::~NEIm2ColKernel().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
Referenced by NEIm2ColKernel::name().
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Execute the kernel on the passed window.
[in] | window | Region on which to execute the kernel. (Must be a region of the window returned by window()) |
[in] | info | Info about executing thread and CPU. |
Reimplemented from ICPPKernel.
Definition at line 454 of file NEIm2ColKernel.cpp.
References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, and IKernel::window().
Referenced by NEIm2ColKernel::name().
|
static |
Static function to check if given info will lead to a valid configuration of NEIm2ColKernel.
[in] | input | The input tensor to convert. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: QASYMM8/QASYMM8_SIGNED/BFLOAT16/F16/F32 Note: QASYMM8/QASYMM8_SIGNED works only for has_bias = false |
[in] | output | The output tensor. Data types supported: Same as input |
[in] | kernel_dims | The kernel dimensions (width and height). |
[in] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | has_bias | In case biases are provided expands the matrix with 1. |
[in] | dilation | (Optional) Dilation, in elements, across x and y. Defaults to (1, 1). |
[in] | num_groups | (Optional) Number of groups when performing a grouped convolution. num_groups != 1 is not supported |
Definition at line 446 of file NEIm2ColKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), arm_compute::test::validation::conv_info, arm_compute::test::validation::has_bias, and arm_compute::validate_arguments().
Referenced by NEIm2ColKernel::name(), and NEGEMMConvolutionLayer::validate().