Compute Library
 21.05
NEArithmeticAddition Class Reference

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

#include <NEArithmeticAddition.h>

Collaboration diagram for NEArithmeticAddition:
[legend]

Public Member Functions

 NEArithmeticAddition ()
 Default Constructor. More...
 
 ~NEArithmeticAddition ()
 Default Destructor. More...
 
 NEArithmeticAddition (const NEArithmeticAddition &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEArithmeticAddition (NEArithmeticAddition &&)
 Default move constructor. More...
 
NEArithmeticAdditionoperator= (const NEArithmeticAddition &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEArithmeticAdditionoperator= (NEArithmeticAddition &&)
 Default move assignment operator. More...
 
void configure (const ITensor *input1, const ITensor *input2, ITensor *output, ConvertPolicy policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's inputs, output and conversion policy. More...
 
void run () override
 Run the kernels contained in the function. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 
virtual void prepare ()
 Prepare the function for executing. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Static function to check if given info will lead to a valid configuration of NEArithmeticAddition. More...
 

Detailed Description

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

Definition at line 37 of file NEArithmeticAddition.h.

Constructor & Destructor Documentation

◆ NEArithmeticAddition() [1/3]

Default Constructor.

Definition at line 41 of file NEArithmeticAddition.cpp.

42  : _impl(std::make_unique<Impl>())
43 {
44 }

◆ ~NEArithmeticAddition()

~NEArithmeticAddition ( )
default

Default Destructor.

◆ NEArithmeticAddition() [2/3]

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

◆ NEArithmeticAddition() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( const ITensor input1,
const ITensor input2,
ITensor output,
ConvertPolicy  policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

Initialise the kernel's inputs, output and conversion policy.

Valid data layouts:

  • All

Valid data type configurations:

src0 src1 dst
QASYMM8 QASYMM8 QASYMM8
QASYMM8_SIGNED QASYMM8_SIGNED QASYMM8_SIGNED
QSYMM16 QSYMM16 QASYMM16
QSYMM16 QSYMM16 S32
U8 U8 U8
U8 U8 S16
U8 S16 S16
S16 U8 S16
S16 S16 S16
S32 S32 S32
F16 F16 F16
F32 F32 F32
Parameters
[in]input1First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]input2Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[out]outputOutput tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]policyPolicy to use to handle overflow.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.

Definition at line 54 of file NEArithmeticAddition.cpp.

55 {
56  _impl->src_0 = input1;
57  _impl->src_1 = input2;
58  _impl->dst = output;
59  _impl->op = std::make_unique<cpu::CpuAdd>();
60  _impl->op->configure(_impl->src_0->info(), _impl->src_1->info(), _impl->dst->info(), policy, act_info);
61 }

Referenced by NERNNLayer::configure(), NEFFTConvolutionLayer::configure(), NEGEMM::configure(), NELSTMLayerQuantized::configure(), NELSTMLayer::configure(), NEQLSTMLayer::configure(), and arm_compute::test::validation::TEST_CASE().

◆ operator=() [1/2]

NEArithmeticAddition& operator= ( const NEArithmeticAddition )
delete

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

◆ operator=() [2/2]

NEArithmeticAddition & operator= ( NEArithmeticAddition &&  )
default

Default move assignment operator.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For CPU kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 63 of file NEArithmeticAddition.cpp.

64 {
65  ITensorPack pack;
66  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
67  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
68  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
69  _impl->op->run(pack);
70 }

References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, and ITensorPack::add_tensor().

Referenced by NEQLSTMLayer::prepare(), NERNNLayer::run(), NEGEMM::run(), NEFFTConvolutionLayer::run(), NELSTMLayerQuantized::run(), NELSTMLayer::run(), and NEQLSTMLayer::run().

◆ validate()

Status validate ( const ITensorInfo input1,
const ITensorInfo input2,
const ITensorInfo output,
ConvertPolicy  policy,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)
static

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

Parameters
[in]input1First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]input2Second tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]outputOutput tensor info. Data types supported: U8/SQASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/S32/F32
[in]policyPolicy to use to handle overflow
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.
Returns
a status

Definition at line 49 of file NEArithmeticAddition.cpp.

50 {
51  return cpu::CpuAdd::validate(input1, input2, output, policy, act_info);
52 }
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 of CpuAdd.
Definition: CpuAdd.cpp:40

References CpuAdd::validate().

Referenced by NERNNLayer::validate(), NEGEMM::validate(), NELSTMLayerQuantized::validate(), NELSTMLayer::validate(), and NEQLSTMLayer::validate().


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