Compute Library
 19.08
NEElementwiseOperationKernel Class Reference

Interface for an element-wise operation kernel. More...

#include <NEElementwiseOperationKernel.h>

Collaboration diagram for NEElementwiseOperationKernel:
[legend]

Public Types

using ElementwiseFunction = void(const ITensor *input1, const ITensor *input2, ITensor *output, const Window &window)
 Common signature for all the specialised arithmetic functions. More...
 

Public Member Functions

const char * name () const override
 Name of the kernel. More...
 
 NEElementwiseOperationKernel ()
 Default constructor. More...
 
 NEElementwiseOperationKernel (const NEElementwiseOperationKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEElementwiseOperationKerneloperator= (const NEElementwiseOperationKernel &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEElementwiseOperationKernel (NEElementwiseOperationKernel &&)=default
 Allow instances of this class to be moved. More...
 
NEElementwiseOperationKerneloperator= (NEElementwiseOperationKernel &&)=default
 Allow instances of this class to be moved. More...
 
 ~NEElementwiseOperationKernel ()=default
 Default destructor. 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...
 

Detailed Description

Interface for an element-wise operation kernel.

Element-wise operation is computed by:

\[ output(x,y) = OP(input1(x,y), input2(x,y))\]

Definition at line 40 of file NEElementwiseOperationKernel.h.

Member Typedef Documentation

◆ ElementwiseFunction

using ElementwiseFunction = void(const ITensor *input1, const ITensor *input2, ITensor *output, const Window &window)

Common signature for all the specialised arithmetic functions.

Parameters
[in]input1First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32.
[in]input2Second tensor input. Data types supported: Same as input1.
[in]outputOutput tensor. Data types supported: Dependent on subclass.
[in]windowRegion on which to execute the kernel.

Definition at line 70 of file NEElementwiseOperationKernel.h.

Constructor & Destructor Documentation

◆ NEElementwiseOperationKernel() [1/3]

Default constructor.

Definition at line 804 of file NEElementwiseOperationKernel.cpp.

805  : _function(nullptr), _input1(nullptr), _input2(nullptr), _output(nullptr)
806 {
807 }

◆ NEElementwiseOperationKernel() [2/3]

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

◆ NEElementwiseOperationKernel() [3/3]

Allow instances of this class to be moved.

◆ ~NEElementwiseOperationKernel()

Default destructor.

Member Function Documentation

◆ name()

const char* name ( ) const
inlineoverridevirtual

Name of the kernel.

Returns
Kernel name

Implements ICPPKernel.

Definition at line 43 of file NEElementwiseOperationKernel.h.

44  {
45  return "NEElementwiseOperationKernel";
46  }

◆ 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 851 of file NEElementwiseOperationKernel.cpp.

852 {
856  ARM_COMPUTE_ERROR_ON(_function == nullptr);
857  _function(_input1, _input2, _output, window);
858 }
const Window & window() const
The maximum window the kernel can be executed on.
Definition: IKernel.cpp:28
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:337
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:160
#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_ON, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, arm_compute::test::validation::info, and IKernel::window().


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