Compute Library
CpuElementwiseKernel Class Referenceabstract

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

#include <CpuElementwiseKernel.h>

Collaboration diagram for CpuElementwiseKernel:

Data Structures

struct  UKernelInfo

Public Types

using ElementwiseFunction = void(const ITensor *, const ITensor *, ITensor *, const Window &)

Public Member Functions

 CpuElementwiseKernel ()=default
void run_op (ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
 Execute the kernel on the passed window. More...
const char * name () const override
 Name of the kernel. More...
- Public Member Functions inherited from ICPPKernel
virtual ~ICPPKernel ()=default
 Default destructor. More...
virtual void run (const Window &window, const ThreadInfo &info)
 Execute the kernel on the passed window. 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...
- 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...
bool is_window_configured () const
 Function to check if the embedded window of this kernel has been configured. More...

Detailed Description

Interface for an element-wise operation kernel.

Element-wise operation is computed by:

\[ dst(x,y) = OP(src0(x,y), src1(x,y))\]

Definition at line 42 of file CpuElementwiseKernel.h.

Member Typedef Documentation

◆ ElementwiseFunction

using ElementwiseFunction = void(const ITensor *, const ITensor *, ITensor *, const Window &)

Definition at line 48 of file CpuElementwiseKernel.h.

Constructor & Destructor Documentation

◆ CpuElementwiseKernel()

CpuElementwiseKernel ( )

Member Function Documentation



◆ name()

const char * name ( ) const

Name of the kernel.

Kernel name

Implements ICPPKernel.

Definition at line 307 of file CpuElementwiseKernel.cpp.

308 {
309  return _name.c_str();
310 }

◆ run_op()

void run_op ( ITensorPack tensors,
const Window window,
const ThreadInfo info 

Execute the kernel on the passed window.

If is_parallelisable() returns false then the passed window must be equal to window()
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().
[in]tensorsA vector containing the tensors to operate on.
[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.

Reimplemented from ICPPKernel.

Definition at line 295 of file CpuElementwiseKernel.cpp.

References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_UNUSED, ITensorPack::get_const_tensor(), and ITensorPack::get_tensor().

296 {
298  ARM_COMPUTE_ERROR_ON(_run_method == nullptr);
300  auto src0 = tensors.get_const_tensor(TensorType::ACL_SRC_0);
301  auto src1 = tensors.get_const_tensor(TensorType::ACL_SRC_1);
302  auto dst = tensors.get_tensor(TensorType::ACL_DST);
304  _run_method(src0, src1, dst, window);
305 }
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:466
To avoid unused variables warnings.
Definition: Error.h:152
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

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