21.02
|
Interface for an element-wise unary operation kernel. More...
#include <CpuElementwiseUnaryKernel.h>
Public Types | |
using | ElementwiseUnaryUkernelPtr = std::add_pointer< void(const ITensor *, ITensor *, const Window &, ElementWiseUnary)>::type |
Common signature for all the specialised elementwise unary micro-kernels. More... | |
Public Member Functions | |
const char * | name () const override |
Name of the kernel. More... | |
CpuElementwiseUnaryKernel () | |
Default constructor. More... | |
~CpuElementwiseUnaryKernel ()=default | |
Default destructor. More... | |
ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE (CpuElementwiseUnaryKernel) | |
void | configure (ElementWiseUnary op, const ITensorInfo &input, ITensorInfo &output) |
Function to configure the CpuElementwiseUnaryKernel. More... | |
void | run_op (ITensorPack &tensors, 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 (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 Window & | window () const |
The maximum window the kernel can be executed on. More... | |
Static Public Member Functions | |
static Status | validate (ElementWiseUnary op, const ITensorInfo &input, const ITensorInfo &output) |
Static function to check if given info will lead to a valid configuration of CpuElementwiseUnaryKernel. More... | |
Interface for an element-wise unary operation kernel.
Element-wise operation is computed by:
\[ output(x) = OP(input(x))\]
Definition at line 44 of file CpuElementwiseUnaryKernel.h.
using ElementwiseUnaryUkernelPtr = std::add_pointer<void(const ITensor *, ITensor *, const Window &, ElementWiseUnary)>::type |
Common signature for all the specialised elementwise unary micro-kernels.
[in] | window | Region on which to execute the kernel. |
Definition at line 82 of file CpuElementwiseUnaryKernel.h.
Default constructor.
Definition at line 106 of file CpuElementwiseUnaryKernel.cpp.
Referenced by CpuElementwiseUnaryKernel::name().
|
default |
Default destructor.
Referenced by CpuElementwiseUnaryKernel::name().
ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE | ( | CpuElementwiseUnaryKernel | ) |
Referenced by CpuElementwiseUnaryKernel::name().
void configure | ( | ElementWiseUnary | op, |
const ITensorInfo & | input, | ||
ITensorInfo & | output | ||
) |
Function to configure the CpuElementwiseUnaryKernel.
[in] | op | Arithmetic operation to be executed. |
[in] | input | First tensor input. Data types supported: F16/F32, F16/F32/S32 for NEG/ABS operations. |
[out] | output | Output tensor. Data types supported: Same as input . |
Definition at line 111 of file CpuElementwiseUnaryKernel.cpp.
References ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), ITensorInfo::broadcast_shape_and_valid_region(), arm_compute::calculate_max_window(), ITensorInfo::data_type(), arm_compute::test::validation::valid_region, and CpuElementwiseUnaryKernel::validate().
Referenced by CpuElementwiseUnaryKernel::name().
|
inlineoverridevirtual |
Name of the kernel.
Implements ICPPKernel.
Definition at line 47 of file CpuElementwiseUnaryKernel.h.
References CpuElementwiseUnaryKernel::ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(), CpuElementwiseUnaryKernel::configure(), CpuElementwiseUnaryKernel::CpuElementwiseUnaryKernel(), arm_compute::test::validation::info, arm_compute::test::validation::input, CpuElementwiseUnaryKernel::run_op(), CpuElementwiseUnaryKernel::validate(), IKernel::window(), and CpuElementwiseUnaryKernel::~CpuElementwiseUnaryKernel().
|
overridevirtual |
Execute the kernel on the passed window.
[in] | tensors | A vector containing the tensors to operate on. |
[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 162 of file CpuElementwiseUnaryKernel.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW, ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL, ARM_COMPUTE_UNUSED, arm_compute::test::validation::dst, func, ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), arm_compute::test::validation::src, ukernel, and IKernel::window().
Referenced by CpuElementwiseUnaryKernel::name().
|
static |
Static function to check if given info will lead to a valid configuration of CpuElementwiseUnaryKernel.
[in] | op | Arithmetic operation to be executed. |
[in] | input | First tensor input info. Data types supported: F16/F32, F16/F32/S32 for NEG/ABS operations. |
[in] | output | Output tensor info. Data types supported: Same as input . |
Definition at line 130 of file CpuElementwiseUnaryKernel.cpp.
References arm_compute::ABS, ARM_COMPUTE_ERROR, ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ITensorInfo::data_type(), arm_compute::EXP, arm_compute::F16, arm_compute::F32, arm_compute::LOG, arm_compute::NEG, arm_compute::ROUND, arm_compute::RSQRT, arm_compute::S32, arm_compute::SIN, and ITensorInfo::total_size().
Referenced by CpuElementwiseUnaryKernel::configure(), CpuElementwiseUnaryKernel::name(), and CpuElementwiseUnary::validate().