Compute Library
 19.08
NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols > Class Template Referencefinal

NEON kernel to perform Winograd weights transform. More...

#include <NEWinogradConvolutionLayerKernel.h>

Collaboration diagram for NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >:
[legend]

Public Member Functions

 NEWinogradLayerTransformWeightsKernel (const NEWinogradLayerTransformWeightsKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEWinogradLayerTransformWeightsKerneloperator= (const NEWinogradLayerTransformWeightsKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEWinogradLayerTransformWeightsKernel (NEWinogradLayerTransformWeightsKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEWinogradLayerTransformWeightsKerneloperator= (NEWinogradLayerTransformWeightsKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEWinogradLayerTransformWeightsKernel ()=default
 Default destructor. More...
 
 NEWinogradLayerTransformWeightsKernel ()
 Default constructor. More...
 
const char * name () const override
 Name of the kernel. More...
 
unsigned int get_weight_storage_size (int num_output_channels, int num_input_channels) const override
 Determine how much memory (in units of T) to allocate for the transformed weights. More...
 
int get_matrix_stride (const KernelShape &kernel_shape) const override
 Gets the stride between matrices in the input worspace. More...
 
void run (const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
 
bool is_parallelisable () const override
 Indicates whether or not the kernel is parallelisable. More...
 
- Public Member Functions inherited from INEWinogradLayerTransformWeightsKernel< T >
 INEWinogradLayerTransformWeightsKernel (const INEWinogradLayerTransformWeightsKernel &)=default
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
INEWinogradLayerTransformWeightsKerneloperator= (const INEWinogradLayerTransformWeightsKernel &)=default
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 INEWinogradLayerTransformWeightsKernel (INEWinogradLayerTransformWeightsKernel &&)=default
 Allow instances of this class to be moved. More...
 
INEWinogradLayerTransformWeightsKerneloperator= (INEWinogradLayerTransformWeightsKernel &&)=default
 Allow instances of this class to be moved. More...
 
 INEWinogradLayerTransformWeightsKernel ()
 
virtual ~INEWinogradLayerTransformWeightsKernel ()
 
virtual void configure (const ITensor *weights_hwio, ITensor *output, const int matrix_stride, const int num_output_channels, const int num_input_channels)=0
 Configure the weights transform kernel. More...
 
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
 
- Public Member Functions inherited from IKernel
 IKernel ()
 Constructor. More...
 
virtual ~IKernel ()=default
 Destructor. More...
 
virtual BorderSize border_size () const
 The size of the border for that kernel. More...
 
const Windowwindow () 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 WinogradInfo &winograd_info)
 Static function to check if given info will lead to a valid configuration of NEWinogradLayerTransformWeightsKernel. More...
 
- Static Public Member Functions inherited from INEWinogradLayerTransformWeightsKernel< T >
static Status validate (const ITensorInfo *input, const ITensorInfo *weights)
 Static function to check if given info will lead to a valid configuration of NEWinogradLayerTransformWeightsKernel. More...
 

Detailed Description

template<typename T, int OutputTileRows, int OutputTileCols, int KernelRows, int KernelCols>
class arm_compute::NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols >

NEON kernel to perform Winograd weights transform.

Definition at line 480 of file NEWinogradConvolutionLayerKernel.h.

Constructor & Destructor Documentation

◆ NEWinogradLayerTransformWeightsKernel() [1/3]

NEWinogradLayerTransformWeightsKernel ( const NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols > &  )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ NEWinogradLayerTransformWeightsKernel() [2/3]

NEWinogradLayerTransformWeightsKernel ( NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols > &&  )
default

Allow instances of this class to be moved.

◆ ~NEWinogradLayerTransformWeightsKernel()

Default destructor.

◆ NEWinogradLayerTransformWeightsKernel() [3/3]

Default constructor.

Definition at line 240 of file NEWinogradConvolutionLayerKernel.cpp.

241  : _transform(nullptr), _weights_hwio(nullptr), _output(nullptr), _matrix_stride(0), _num_output_channels(0), _num_input_channels(0)
242 {
243 }

Member Function Documentation

◆ get_matrix_stride()

int get_matrix_stride ( const KernelShape &  kernel_shape) const
overridevirtual

Gets the stride between matrices in the input worspace.

Parameters
[in]kernel_shapeThe shape of the weights tensor.
Returns
Stride expressed in bytes.

Implements INEWinogradLayerTransformWeightsKernel< T >.

Definition at line 246 of file NEWinogradConvolutionLayerKernel.cpp.

247 {
248  return WinogradConv::get_kernel_matrix_stride(kernel_shape);
249 }

◆ get_weight_storage_size()

unsigned int get_weight_storage_size ( int  num_output_channels,
int  num_input_channels 
) const
overridevirtual

Determine how much memory (in units of T) to allocate for the transformed weights.

Parameters
[in]num_output_channelsNumber of output feature maps.
[in]num_input_channelsNumber of input feature maps.
Returns
Storage size (in units of T) required.

Implements INEWinogradLayerTransformWeightsKernel< T >.

Definition at line 231 of file NEWinogradConvolutionLayerKernel.cpp.

232 {
233  const KernelShape shape(num_output_channels, KernelRows, KernelCols, num_input_channels);
234  return static_cast<unsigned int>(
235  // WinogradConv returns the size in bytes, we divide by `sizeof(T)` to express that in units of T
236  WinogradConv::get_kernel_storage_size(shape) / sizeof(T));
237 }

References arm_compute::test::validation::shape.

◆ is_parallelisable()

bool is_parallelisable ( ) const
overridevirtual

Indicates whether or not the kernel is parallelisable.

If the kernel is parallelisable then the window returned by window() can be split into sub-windows which can then be run in parallel.

If the kernel is not parallelisable then only the window returned by window() can be passed to run()

Returns
True if the kernel is parallelisable

Reimplemented from IKernel.

Definition at line 290 of file NEWinogradConvolutionLayerKernel.cpp.

291 {
292  return false;
293 }

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 496 of file NEWinogradConvolutionLayerKernel.h.

497  {
498  return "NEWinogradLayerTransformWeightsKernel";
499  }

◆ operator=() [1/2]

NEWinogradLayerTransformWeightsKernel& operator= ( const NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols > &  )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

NEWinogradLayerTransformWeightsKernel& operator= ( NEWinogradLayerTransformWeightsKernel< T, OutputTileRows, OutputTileCols, KernelRows, KernelCols > &&  )
default

Allow instances of this class to be moved.

◆ run()

void run ( const Window window,
const ThreadInfo info 
)
overridevirtual

Execute the kernel on the passed window.

Warning
If is_parallelisable() returns false then the passed window must be equal to window()
Note
The window has to be a region within the window returned by the window() method
The width of the window has to be a multiple of num_elems_processed_per_iteration().
Parameters
[in]windowRegion on which to execute the kernel. (Must be a region of the window returned by window())
[in]infoInfo about executing thread and CPU.

Implements ICPPKernel.

Definition at line 275 of file NEWinogradConvolutionLayerKernel.cpp.

276 {
279  const size_t fst = window.x().start();
280  const size_t lst = window.x().end();
281  _transform->set_weight_tensor(_weights_hwio->buffer());
282  const int matrix_row_stride = roundup(_num_output_channels, WinogradConv::N_BLOCK);
283  _transform->set_output_matrices(_output->buffer(), _matrix_stride, matrix_row_stride);
284  _transform->set_working_space(_output->buffer());
285 
286  _transform->run(fst, lst);
287 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
virtual uint8_t * buffer() const =0
Interface to be implemented by the child class to return a pointer to CPU memory.
T roundup(const T a, const T b)
Definition: utils.hpp:41
constexpr int end() const
Return the end of the dimension.
Definition: Window.h:97
constexpr int start() const
Return the start of the dimension.
Definition: Window.h:92
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:940
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
Definition: Window.h:143

References ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, Window::Dimension::end(), arm_compute::test::validation::info, roundup(), Window::Dimension::start(), and Window::x().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const WinogradInfo winograd_info 
)
static

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

Parameters
[in]inputSource tensor info. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout). kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
[in]outputDestination tensor info. The output is a 3D tensor with dimensions [OFM, IFM, 16] or [OFM, IFM, 36]. Data type supported: same as input
[in]winograd_infoContains Winograd's information described in WinogradInfo
Returns
a status

Definition at line 296 of file NEWinogradConvolutionLayerKernel.cpp.

298 {
299  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments_winograd_weight_trans(input, output, winograd_info));
300  ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window_winograd_weight_trans(input->clone().get(), output->clone().get(), winograd_info).first);
301  return Status{};
302 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:193

References ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), and arm_compute::test::validation::winograd_info.


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