Compute Library
 21.02
NEElementwisePower Class Reference

Basic function to run cpu::kernels::CpuArithmeticKernel for power. More...

#include <NEElementwiseOperations.h>

Collaboration diagram for NEElementwisePower:
[legend]

Public Member Functions

 NEElementwisePower ()
 Default Constructor. More...
 
 ~NEElementwisePower ()
 Default Destructor. More...
 
 NEElementwisePower (const NEElementwisePower &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEElementwisePower (NEElementwisePower &&)
 Default move constructor. More...
 
NEElementwisePoweroperator= (const NEElementwisePower &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEElementwisePoweroperator= (NEElementwisePower &&)
 Default move assignment operator. More...
 
void configure (ITensor *input1, ITensor *input2, ITensor *output, 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, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Static function to check if given info will lead to a valid configuration of cpu::kernels::CpuArithmeticKernel for power. More...
 

Detailed Description

Basic function to run cpu::kernels::CpuArithmeticKernel for power.

Note
The tensor data type for the inputs must be F16/F32.
The function performs a elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i])
For an exponent that is a float, this function will only work with a positive base.

Definition at line 229 of file NEElementwiseOperations.h.

Constructor & Destructor Documentation

◆ NEElementwisePower() [1/3]

Default Constructor.

Definition at line 206 of file NEElementwiseOperations.cpp.

References NEElementwisePower::operator=(), and NEElementwisePower::~NEElementwisePower().

207  : _impl(std::make_unique<Impl>())
208 {
209 }

◆ ~NEElementwisePower()

~NEElementwisePower ( )
default

Default Destructor.

Referenced by NEElementwisePower::NEElementwisePower().

◆ NEElementwisePower() [2/3]

NEElementwisePower ( const NEElementwisePower )
delete

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

◆ NEElementwisePower() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

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

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

Parameters
[in,out]input1First tensor input. Data types supported: F16/F32.
[in,out]input2Second tensor input. Data types supported: Same as input1.
[out]outputOutput tensor. Data types supported: Same as input1.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.

Definition at line 214 of file NEElementwiseOperations.cpp.

References ARM_COMPUTE_UNUSED, and ITensor::info().

215 {
216  ARM_COMPUTE_UNUSED(act_info);
217  _impl->src_0 = input1;
218  _impl->src_1 = input2;
219  _impl->dst = output;
220  _impl->op = std::make_unique<cpu::CpuElementwisePower>();
221  _impl->op->configure(input1->info(), input2->info(), output->info());
222 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

◆ operator=() [1/2]

NEElementwisePower& operator= ( const NEElementwisePower )
delete

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

Referenced by NEElementwisePower::NEElementwisePower().

◆ operator=() [2/2]

NEElementwisePower & operator= ( NEElementwisePower &&  )
default

Default move assignment operator.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon 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 230 of file NEElementwiseOperations.cpp.

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

231 {
232  ITensorPack pack;
233  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
234  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
235  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
236  _impl->op->run(pack);
237 }

◆ validate()

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

Static function to check if given info will lead to a valid configuration of cpu::kernels::CpuArithmeticKernel for power.

Parameters
[in]input1First tensor input info. Data types supported: F16/F32.
[in]input2Second tensor input info. Data types supported: Same as input1.
[in]outputOutput tensor info. Data types supported: Same as input1.
[in]act_info(Optional) Activation layer information in case of a fused activation. Currently not supported.
Returns
a status

Definition at line 224 of file NEElementwiseOperations.cpp.

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

225 {
226  ARM_COMPUTE_RETURN_ERROR_ON(act_info.enabled());
227  return cpu::CpuElementwisePower::validate(input1, input2, output);
228 }
#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 *input1, const ITensorInfo *input2, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of cpu::kernels::CpuArithme...

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