Compute Library
 19.08
NEIm2Col Class Reference

Basic function to run NEIm2ColKernel. More...

#include <NEIm2Col.h>

Collaboration diagram for NEIm2Col:
[legend]

Public Member Functions

 NEIm2Col ()
 Default constructor. 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)
 Configure the im2col NEON kernel. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. 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 NEIm2Col. More...
 

Detailed Description

Basic function to run NEIm2ColKernel.

Definition at line 38 of file NEIm2Col.h.

Constructor & Destructor Documentation

◆ NEIm2Col()

NEIm2Col ( )

Default constructor.

Definition at line 32 of file NEIm2Col.cpp.

33  : _kernel(), _y_dim(1)
34 {
35 }

Member Function Documentation

◆ configure()

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 
)

Configure the im2col NEON kernel.

Parameters
[in]inputThe 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/F16/F32 Note: QASYMM8 works only for has_bias = false
[out]outputThe output tensor. Data types supported: Same as input
[in]kernel_dimsThe kernel dimensions (width and height).
[in]conv_infoContains padding and stride information described in PadStrideInfo.
[in]has_biasIn 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

Definition at line 37 of file NEIm2Col.cpp.

38 {
40 
41  _kernel.configure(input, output, kernel_dims, conv_info, has_bias, dilation, num_groups);
42 }
const unsigned int num_groups
Definition: Im2Col.cpp:148
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
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.
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:326
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.

References NEIm2ColKernel::configure(), arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), arm_compute::test::validation::dilation, arm_compute::get_data_layout_dimension_index(), arm_compute::test::validation::has_bias, arm_compute::HEIGHT, ITensor::info(), and arm_compute::test::validation::num_groups.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For NEON kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 50 of file NEIm2Col.cpp.

51 {
52  NEScheduler::get().schedule(&_kernel, _y_dim);
53 }
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:96

References Scheduler::get(), and IScheduler::schedule().

◆ validate()

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

Static function to check if given info will lead to a valid configuration of NEIm2Col.

Parameters
[in]inputThe 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/F16/F32 Note: QASYMM8 works only for has_bias = false
[in]outputThe output tensor. Data types supported: Same as input
[in]kernel_dimsThe kernel dimensions (width and height).
[in]conv_infoContains padding and stride information described in PadStrideInfo.
[in]has_biasIn 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
Returns
a status

Definition at line 44 of file NEIm2Col.cpp.

46 {
47  return NEIm2ColKernel::validate(input, output, kernel_dims, conv_info, has_bias, dilation, num_groups);
48 }
const unsigned int num_groups
Definition: Im2Col.cpp:148
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.

References arm_compute::test::validation::conv_info, arm_compute::test::validation::dilation, arm_compute::test::validation::has_bias, arm_compute::test::validation::num_groups, and NEIm2ColKernel::validate().


The documentation for this class was generated from the following files: