Compute Library
 22.11
CpuAdd Class Reference

Basic function to run kernels::CpuAddKernel. More...

#include <CpuAdd.h>

Collaboration diagram for CpuAdd:
[legend]

Public Member Functions

void configure (const ITensorInfo *src0, const ITensorInfo *src1, ITensorInfo *dst, ConvertPolicy policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's input, dst and border mode. More...
 
void run (ITensorPack &tensors) override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from INEOperator
 INEOperator (IRuntimeContext *ctx=nullptr)
 Constructor. More...
 
 INEOperator (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 INEOperator (INEOperator &&)=default
 Default move constructor. More...
 
INEOperatoroperator= (const INEOperator &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
INEOperatoroperator= (INEOperator &&)=default
 Default move assignment operator. More...
 
 ~INEOperator ()
 Default destructor. More...
 
void prepare (ITensorPack &constants) override
 Prepare the function for executing. More...
 
MemoryRequirements workspace () const override
 Return the memory requirements required by the workspace. More...
 
- Public Member Functions inherited from IOperator
virtual ~IOperator ()=default
 Destructor. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst, ConvertPolicy policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Static function to check if given info will lead to a valid configuration. More...
 

Detailed Description

Basic function to run kernels::CpuAddKernel.

Definition at line 34 of file CpuAdd.h.

Member Function Documentation

◆ configure()

void configure ( const ITensorInfo src0,
const ITensorInfo src1,
ITensorInfo dst,
ConvertPolicy  policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Initialise the kernel's input, dst and border mode.

Valid configurations (src0,src1) -> dst :

  • (U8,U8) -> U8
  • (S16,S16) -> S16
  • (S32,S32) -> S32
  • (F16,F16) -> F16
  • (F32,F32) -> F32
  • (QASYMM8,QASYMM8) -> QASYMM8
  • (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED
  • (QSYMM16,QSYMM16) -> QSYMM16
Parameters
[in]src0First input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]src1Second input tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[out]dstThe dst tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32.
[in]policyOverflow policy.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.

Definition at line 36 of file CpuAdd.cpp.

References ARM_COMPUTE_LOG_PARAMS, ARM_COMPUTE_UNUSED, and arm_compute::test::validation::k.

37 {
38  ARM_COMPUTE_UNUSED(act_info);
39  ARM_COMPUTE_LOG_PARAMS(src0, src1, dst, policy, act_info);
40  auto k = std::make_unique<kernels::CpuAddKernel>();
41  k->configure(src0, src1, dst, policy);
42  _kernel = std::move(k);
43 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_LOG_PARAMS(...)

◆ run()

void run ( ITensorPack tensors)
overridevirtual

Run the kernels contained in the function.

Parameters
[in]tensorsVector that contains the tensors to operate on.

Reimplemented from INEOperator.

Definition at line 51 of file CpuAdd.cpp.

References Scheduler::get(), and IScheduler::schedule_op().

52 {
53  const auto split_dimension = static_cast<kernels::CpuAddKernel *>(_kernel.get())->get_split_dimension();
54 
55  NEScheduler::get().schedule_op(_kernel.get(), split_dimension, _kernel->window(), tensors);
56 }
virtual void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors)=0
Runs the kernel in the same thread as the caller synchronously.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:94

◆ validate()

Status validate ( const ITensorInfo src0,
const ITensorInfo src1,
const ITensorInfo dst,
ConvertPolicy  policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)
static

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

Similar to CpuAdd::configure()

Returns
a status

Definition at line 45 of file CpuAdd.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON, ActivationLayerInfo::enabled(), and CpuAddKernel::validate().

Referenced by NEArithmeticAddition::validate(), and CpuGemm::validate().

46 {
47  ARM_COMPUTE_RETURN_ERROR_ON(act_info.enabled());
48  return kernels::CpuAddKernel::validate(src0, src1, dst, policy);
49 }
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:296
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst, ConvertPolicy policy)
Static function to check if given info will lead to a valid configuration.

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