21.08
|
Interface for the im2col reshape kernel. More...
#include <CpuIm2ColKernel.h>
Public Member Functions | |
CpuIm2ColKernel ()=default | |
Default constructor. More... | |
ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE (CpuIm2ColKernel) | |
void | configure (const ITensorInfo *src, ITensorInfo *dst, 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_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) override |
Execute the kernel on the passed window. More... | |
const char * | name () const override |
Name of the kernel. More... | |
![]() | |
virtual | ~ICPPKernel ()=default |
Default destructor. More... | |
virtual void | run (const Window &window, const ThreadInfo &info) |
Execute the kernel on the passed window. 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... | |
![]() | |
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... | |
bool | is_window_configured () const |
Function to check if the embedded window of this kernel has been configured. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *src, const ITensorInfo *dst, 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. 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 61 of file CpuIm2ColKernel.h.
|
default |
Default constructor.
ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE | ( | CpuIm2ColKernel | ) |
void configure | ( | const ITensorInfo * | src, |
ITensorInfo * | dst, | ||
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] | src | The input tensor info 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] | dst | The output tensor info. 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 334 of file CpuIm2ColKernel.cpp.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_UNUSED, arm_compute::auto_init_if_empty(), arm_compute::BFLOAT16, arm_compute::calculate_max_window(), arm_compute::CHANNEL, ICloneable< T >::clone(), arm_compute::misc::shape_calculator::compute_im2col_conv_shape(), arm_compute::test::validation::configure(), 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, PadStrideInfo::has_padding(), Size2D::height, arm_compute::HEIGHT, arm_compute::NCHW, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::scaled_dimensions(), Size2D::width, and arm_compute::WIDTH.
|
overridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 442 of file CpuIm2ColKernel.cpp.
|
overridevirtual |
Execute the kernel on the passed window.
[in] | tensors | A vector containing the tensors to operate on. |
[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 432 of file CpuIm2ColKernel.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, ITensorPack::get_const_tensor(), and ITensorPack::get_tensor().
|
static |
Static function to check if given info will lead to a valid configuration.
Similar to CpuIm2ColKernel::configure()
Definition at line 425 of file CpuIm2ColKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR.
Referenced by arm_compute::test::validation::DATA_TEST_CASE(), and CpuGemmConvolution::validate().