21.02
|
Neon kernel to perform reshaping on the weights used by convolution and locally connected layer. More...
#include <NEWeightsReshapeKernel.h>
Public Member Functions | |
const char * | name () const override |
Name of the kernel. More... | |
NEWeightsReshapeKernel () | |
Constructor. More... | |
NEWeightsReshapeKernel (const NEWeightsReshapeKernel &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEWeightsReshapeKernel & | operator= (const NEWeightsReshapeKernel &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEWeightsReshapeKernel (NEWeightsReshapeKernel &&)=default | |
Allow instances of this class to be moved. More... | |
NEWeightsReshapeKernel & | operator= (NEWeightsReshapeKernel &&)=default |
Allow instances of this class to be moved. More... | |
~NEWeightsReshapeKernel ()=default | |
Default destructor. More... | |
void | configure (const ITensor *input, const ITensor *bias, ITensor *output) |
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 *biases, const ITensorInfo *output) |
Static function to check if given info will lead to a valid configuration of NEWeightsReshapeKernel. More... | |
Neon 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 NEIm2ColKernel 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 56 of file NEWeightsReshapeKernel.h.
Constructor.
Definition at line 88 of file NEWeightsReshapeKernel.cpp.
Referenced by NEWeightsReshapeKernel::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 NEWeightsReshapeKernel::name().
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, num_patches] if unshared. Data types supported: All |
[in] | bias | The shared biases tensor to append. Bias is 1D tensor with dimensions [OFM] if shared and 2D tensor with dimensions [OFM, num_patches] if unshared. Data types supported: Same as input |
[out] | output | The output tensor. Data types supported: Same as input |
Definition at line 93 of file NEWeightsReshapeKernel.cpp.
References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), ICloneable< T >::clone(), ITensor::info(), arm_compute::test::validation::input, and arm_compute::validate_arguments().
Referenced by NEWeightsReshapeKernel::name().
|
inlineoverridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 59 of file NEWeightsReshapeKernel.h.
References NEWeightsReshapeKernel::configure(), arm_compute::test::validation::info, arm_compute::test::validation::input, NEWeightsReshapeKernel::NEWeightsReshapeKernel(), NEWeightsReshapeKernel::operator=(), NEWeightsReshapeKernel::run(), NEWeightsReshapeKernel::validate(), IKernel::window(), and NEWeightsReshapeKernel::~NEWeightsReshapeKernel().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
Referenced by NEWeightsReshapeKernel::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 123 of file NEWeightsReshapeKernel.cpp.
References ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, ITensorInfo::dimension(), ITensorInfo::element_size(), arm_compute::execute_window_loop(), ITensor::info(), input_stride_y, input_stride_z, Iterator::ptr(), ITensor::ptr_to_element(), ITensorInfo::strides_in_bytes(), IKernel::window(), Dimensions< T >::x(), Dimensions< T >::y(), and Dimensions< T >::z().
Referenced by NEWeightsReshapeKernel::name().
|
static |
Static function to check if given info will lead to a valid configuration of NEWeightsReshapeKernel.
[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, num_patches] if unshared. Data types supported: All |
[in] | biases | The shared biases tensor to append. Bias is 1D tensor with dimensions [OFM] if shared and 2D tensor with dimensions [OFM, num_patches] if unshared. Data types supported: Same as input |
[in] | output | The output tensor. Should be a 2D Tensor. Data types supported: Same as input |
Definition at line 115 of file NEWeightsReshapeKernel.cpp.
References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), and arm_compute::validate_arguments().
Referenced by NEWeightsReshapeKernel::name(), and NEConvolutionLayerReshapeWeights::validate().