Compute Library
 19.08
NELocallyConnectedMatrixMultiplyKernel Class Reference

NEON kernel to multiply each row of first tensor with low 2 dimensions of second tensor. More...

#include <NELocallyConnectedMatrixMultiplyKernel.h>

Collaboration diagram for NELocallyConnectedMatrixMultiplyKernel:
[legend]

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NELocallyConnectedMatrixMultiplyKernel ()
 Default constructor. More...
 
 NELocallyConnectedMatrixMultiplyKernel (const NELocallyConnectedMatrixMultiplyKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NELocallyConnectedMatrixMultiplyKerneloperator= (const NELocallyConnectedMatrixMultiplyKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NELocallyConnectedMatrixMultiplyKernel (NELocallyConnectedMatrixMultiplyKernel &&)=default
 Allow instances of this class to be moved. More...
 
NELocallyConnectedMatrixMultiplyKerneloperator= (NELocallyConnectedMatrixMultiplyKernel &&)=default
 Allow instances of this class to be moved. More...
 
void configure (const ITensor *input0, const ITensor *input1, ITensor *output)
 Initialise the kernel's input and output. 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...
 
- 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 Windowwindow () const
 The maximum window the kernel can be executed on. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input0, const ITensorInfo *input1, const ITensorInfo *output)
 Static function to check if given info will lead to a valid configuration of NELocallyConnectedMatrixMultiplyKernel. More...
 

Detailed Description

NEON kernel to multiply each row of first tensor with low 2 dimensions of second tensor.

Definition at line 34 of file NELocallyConnectedMatrixMultiplyKernel.h.

Constructor & Destructor Documentation

◆ NELocallyConnectedMatrixMultiplyKernel() [1/3]

Default constructor.

Definition at line 335 of file NELocallyConnectedMatrixMultiplyKernel.cpp.

336  : _input0(nullptr), _input1(nullptr), _output(nullptr)
337 {
338 }

◆ NELocallyConnectedMatrixMultiplyKernel() [2/3]

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

◆ NELocallyConnectedMatrixMultiplyKernel() [3/3]

Allow instances of this class to be moved.

Member Function Documentation

◆ configure()

void configure ( const ITensor input0,
const ITensor input1,
ITensor output 
)

Initialise the kernel's input and output.

Parameters
[in]input0First input tensor. Data types supported: F16, F32
[in]input1Second input tensor containing the Matrix B. Data type supported: same as input0
[out]outputOutput tensor to store the result of matrix multiplication. Data type supported: same as input0

Definition at line 340 of file NELocallyConnectedMatrixMultiplyKernel.cpp.

341 {
342  ARM_COMPUTE_ERROR_ON_NULLPTR(input0, input1, output);
343  ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input0->info(), input1->info(), output->info()));
344 
345  _input0 = input0;
346  _input1 = input1;
347  _output = output;
348 
349  // Configure kernel window
350  auto win_config = validate_and_configure_window(input0->info(), input1->info(), output->info());
351 
352  ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
353 
354  INEKernel::configure(std::get<1>(win_config));
355 }
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:327
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ITensor::info(), and arm_compute::validate_and_configure_window().

Referenced by NELocallyConnectedLayer::configure().

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 37 of file NELocallyConnectedMatrixMultiplyKernel.h.

38  {
39  return "NELocallyConnectedMatrixMultiplyKernel";
40  }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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 365 of file NELocallyConnectedMatrixMultiplyKernel.cpp.

366 {
369 
370  switch(_input0->info()->data_type())
371  {
372  case DataType::F16:
373  {
374  vector_matrix_multiply_f16(_input0, _input1, _output, window, info);
375  break;
376  }
377  case DataType::F32:
378  {
379  vector_matrix_multiply_f32(_input0, _input1, _output, window, info);
380  break;
381  }
382  default:
383  {
384  ARM_COMPUTE_ERROR("Data type not supported");
385  break;
386  }
387  }
388 }
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:261
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
1 channel, 1 F16 per channel
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
Definition: Validate.h:205
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Definition: Validate.h:940

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ITensorInfo::data_type(), arm_compute::F16, arm_compute::F32, ITensor::info(), arm_compute::test::validation::info, and IKernel::window().

◆ validate()

Status validate ( const ITensorInfo input0,
const ITensorInfo input1,
const ITensorInfo output 
)
static

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

Parameters
[in]input0First input tensor info. Data types supported: F16, F32
[in]input1Second input tensor info. Data type supported: same as input0
[in]outputOutput tensor info. Data type supported: same as input0
Returns
a status

Definition at line 357 of file NELocallyConnectedMatrixMultiplyKernel.cpp.

358 {
359  ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input0, input1, output));
360  ARM_COMPUTE_RETURN_ON_ERROR(std::get<0>(validate_and_configure_window(input0->clone().get(), input1->clone().get(), output->clone().get())));
361 
362  return Status{};
363 }
std::pair< Status, Window > validate_and_configure_window(ITensorInfo *input, ITensorInfo *weights, ITensorInfo *biases, ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation)
#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::validate_and_configure_window().

Referenced by NELocallyConnectedLayer::validate().


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