21.02
|
GLES Compute kernel to perform reshaping on the weights used by convolution and locally connected layer. More...
#include <GCWeightsReshapeKernel.h>
Public Member Functions | |
GCWeightsReshapeKernel () | |
Constructor. More... | |
GCWeightsReshapeKernel (const GCWeightsReshapeKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
GCWeightsReshapeKernel & | operator= (const GCWeightsReshapeKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
GCWeightsReshapeKernel (GCWeightsReshapeKernel &&)=default | |
Allow instances of this class to be moved. More... | |
GCWeightsReshapeKernel & | operator= (GCWeightsReshapeKernel &&)=default |
Allow instances of this class to be moved. More... | |
~GCWeightsReshapeKernel ()=default | |
Default destructor. More... | |
void | configure (const IGCTensor *input, const IGCTensor *biases, IGCTensor *output) |
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... | |
GLES Compute kernel to perform reshaping on the weights used by convolution and locally connected layer.
Rearranges each 3-dimensional kernel to a single row leading to a matrix with linearized kernels. In combination with the GCIm2ColKernel can transform a convolution to a matrix multiplication.
For example assuming a 3D weight kernel of 3x3 dimensions and depth of 2 we have:
\[ \left( \begin{array}{ccc} a000 & a001 & a002 \\ a010 & a011 & a012 \\ a020 & a021 & a022 \\ \end{array} \right) \left( \begin{array}{ccc} a100 & a101 & a102 \\ a110 & a111 & a112 \\ a120 & a121 & a122 \\ \end{array} \right) \rightarrow \left( \begin{array}{ccccccccc} a000 & a001 & a002 & a010 & a011 & a012 & a020 & a021 & a022 & a100 & a101 & a102 & a110 & a111 & a112 & a120 & a121 & a122 \\ \end{array} \right) \]
Definition at line 54 of file GCWeightsReshapeKernel.h.
Constructor.
Definition at line 44 of file GCWeightsReshapeKernel.cpp.
|
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.
Set the input and output of the kernel.
[in] | input | The input tensor to convert. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] if shared, and 5D tensor with dimensions [kernel_x, kernel_y, IFM, OFM, batches] if unshared. Data types supported: F16, F32 |
[in] | biases | The shared biases tensor to append. Bias is 1D tensor with dimensions [OFM] if shared and 2D tensor with dimensions [OFM, batches] if unshared. Data types supported: Same as input |
[out] | output | The output tensor. Should be a 2D Tensor. Data types supported: Same as input |
Definition at line 49 of file GCWeightsReshapeKernel.cpp.
References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_ERROR_ON_NULLPTR, arm_compute::auto_init_if_empty(), arm_compute::calculate_max_window(), ICloneable< T >::clone(), arm_compute::misc::shape_calculator::compute_weights_reshaped_shape(), GCKernelLibrary::create_kernel(), ITensorInfo::data_type(), ITensorInfo::dimension(), arm_compute::F16, arm_compute::F32, GCKernelLibrary::get(), ITensor::info(), arm_compute::test::validation::input, IGCKernel::num_arguments_per_1D_tensor(), IGCKernel::num_arguments_per_2D_tensor(), IGCKernel::num_arguments_per_3D_tensor(), ITensorInfo::num_dimensions(), ITensorInfo::set_valid_region(), ITensorInfo::tensor_shape(), and arm_compute::support::cpp11::to_string().
Referenced by GCConvolutionLayerReshapeWeights::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 104 of file GCWeightsReshapeKernel.cpp.
References IGCKernel::add_1D_tensor_argument(), IGCKernel::add_2D_tensor_argument(), IGCKernel::add_3D_tensor_argument(), ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, arm_compute::enqueue(), Window::first_slice_window_1D(), Window::first_slice_window_2D(), Window::first_slice_window_3D(), ITensor::info(), Window::slide_window_slice_1D(), Window::slide_window_slice_2D(), Window::slide_window_slice_4D(), ITensorInfo::tensor_shape(), Window::use_tensor_dimensions(), and IKernel::window().