21.02
|
Interface for the im2col reshape kernel. More...
#include <GCIm2ColKernel.h>
Public Member Functions | |
GCIm2ColKernel () | |
Default constructor. More... | |
GCIm2ColKernel (const GCIm2ColKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
GCIm2ColKernel & | operator= (const GCIm2ColKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
GCIm2ColKernel (GCIm2ColKernel &&)=default | |
Allow instances of this class to be moved. More... | |
GCIm2ColKernel & | operator= (GCIm2ColKernel &&)=default |
Allow instances of this class to be moved. More... | |
void | configure (const IGCTensor *input, IGCTensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation=Size2D(1U, 1U)) |
Set the input and output of the kernel. More... | |
void | run (const Window &window) override |
Enqueue the OpenGL ES shader to process the given window. More... | |
Public Member Functions inherited from IGCKernel | |
IGCKernel () | |
Constructor. More... | |
GCKernel & | kernel () |
Returns a reference to the GLES kernel of this object. More... | |
void | add_1D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
Add the passed 1D tensor's parameters to the object's kernel's arguments starting from the index idx. More... | |
void | add_2D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx. More... | |
void | add_3D_tensor_argument (unsigned int &idx, const IGCTensor *tensor, const unsigned int binding_point, const Window &window) |
Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx. More... | |
unsigned int | num_arguments_per_1D_tensor () const |
Returns the number of arguments enqueued per 1D tensor object. More... | |
unsigned int | num_arguments_per_2D_tensor () const |
Returns the number of arguments enqueued per 2D tensor object. More... | |
unsigned int | num_arguments_per_3D_tensor () const |
Returns the number of arguments enqueued per 3D tensor object. More... | |
void | set_lws_hint (gles::NDRange &lws_hint) |
Set the Local-Workgroup-Size hint. More... | |
void | set_target (GPUTarget target) |
Set the targeted GPU architecture. More... | |
GPUTarget | get_target () const |
Get the targeted GPU architecture. 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)) |
Static function to check if given info will lead to a valid configuration of CLIm2ColKernel. 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) = \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 GCIm2ColKernel.h.
GCIm2ColKernel | ( | ) |
Default constructor.
Definition at line 64 of file GCIm2ColKernel.cpp.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
void configure | ( | const IGCTensor * | input, |
IGCTensor * | output, | ||
const Size2D & | kernel_dims, | ||
const PadStrideInfo & | conv_info, | ||
bool | has_bias, | ||
const Size2D & | dilation = Size2D(1U, 1U) |
||
) |
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: F16/F32 |
[out] | output | The output tensor. First 2 lower dimensions represent a transform of each 3D input, while every dimension above represents a batch. 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). |
Definition at line 69 of file GCIm2ColKernel.cpp.
References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::calculate_max_window(), Dimensions< T >::cbegin(), arm_compute::ceil_to_multiple(), Dimensions< T >::cend(), arm_compute::test::validation::conv_info, GCKernelLibrary::create_kernel(), ITensorInfo::data_type(), ITensorInfo::dimension(), Window::DimZ, ITensorInfo::element_size(), arm_compute::mlgo::parser::end(), arm_compute::F16, arm_compute::F32, GCKernelLibrary::get(), PadStrideInfo::has_padding(), Size2D::height, ITensor::info(), arm_compute::test::validation::input, input_height, input_width, kernel_name, BorderSize::left, Dimensions< size_t >::num_max_dimensions, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), ITensorInfo::padding(), BorderSize::right, arm_compute::scaled_dimensions(), Window::set_dimension_step(), ITensorInfo::set_valid_region(), enable_tracing::start, PadStrideInfo::stride(), ITensorInfo::tensor_shape(), arm_compute::support::cpp11::to_string(), arm_compute::U, arm_compute::update_window_and_padding(), arm_compute::validate_arguments(), Size2D::width, Size2D::x(), and Size2D::y().
Referenced by GCConvolutionLayer::configure().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Enqueue the OpenGL ES shader to process the given window.
[in] | window | Region on which to execute the kernel. (Must be a valid region of the window returned by window()). |
Implements IGCKernel.
Definition at line 223 of file GCIm2ColKernel.cpp.
References IGCKernel::add_1D_tensor_argument(), IGCKernel::add_2D_tensor_argument(), IGCKernel::add_3D_tensor_argument(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, Window::collapse_if_possible(), ITensorInfo::data_type(), ITensorInfo::dimension(), Window::DimX, Window::DimY, Window::DimZ, arm_compute::enqueue(), arm_compute::F16, Window::first_slice_window_1D(), Window::first_slice_window_3D(), ITensor::info(), ITensorInfo::num_channels(), Window::set(), Window::set_dimension_step(), arm_compute::test::validation::reference::slice(), Window::slide_window_slice_1D(), Window::slide_window_slice_3D(), ITensorInfo::strides_in_bytes(), ITensorInfo::tensor_shape(), ITensorInfo::total_size(), Window::use_tensor_dimensions(), and IKernel::window().
|
static |
Static function to check if given info will lead to a valid configuration of CLIm2ColKernel.
[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: F16/F32 |
[in] | output | The output tensor. First 2 lower dimensions represent a transform of each 3D input, while every dimension above represents a batch. 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). |
Definition at line 213 of file GCIm2ColKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, ARM_COMPUTE_UNUSED, and arm_compute::validate_arguments().