Compute Library
 21.02
NEElementwiseMin Class Reference

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

#include <NEElementwiseOperations.h>

Collaboration diagram for NEElementwiseMin:
[legend]

Public Member Functions

 NEElementwiseMin ()
 Default Constructor. More...
 
 ~NEElementwiseMin ()
 Default Destructor. More...
 
 NEElementwiseMin (const NEElementwiseMin &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEElementwiseMin (NEElementwiseMin &&)
 Default move constructor. More...
 
NEElementwiseMinoperator= (const NEElementwiseMin &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEElementwiseMinoperator= (NEElementwiseMin &&)
 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 min. More...
 

Detailed Description

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

Note
The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
The function performs a min operation between two tensors.

Definition at line 87 of file NEElementwiseOperations.h.

Constructor & Destructor Documentation

◆ NEElementwiseMin() [1/3]

Default Constructor.

Definition at line 83 of file NEElementwiseOperations.cpp.

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

84  : _impl(std::make_unique<Impl>())
85 {
86 }

◆ ~NEElementwiseMin()

~NEElementwiseMin ( )
default

Default Destructor.

Referenced by NEElementwiseMin::NEElementwiseMin().

◆ NEElementwiseMin() [2/3]

NEElementwiseMin ( const NEElementwiseMin )
delete

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

◆ NEElementwiseMin() [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: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/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 91 of file NEElementwiseOperations.cpp.

References ARM_COMPUTE_UNUSED, and ITensor::info().

92 {
93  ARM_COMPUTE_UNUSED(act_info);
94  _impl->src_0 = input1;
95  _impl->src_1 = input2;
96  _impl->dst = output;
97  _impl->op = std::make_unique<cpu::CpuElementwiseMin>();
98  _impl->op->configure(input1->info(), input2->info(), output->info());
99 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

◆ operator=() [1/2]

NEElementwiseMin& operator= ( const NEElementwiseMin )
delete

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

Referenced by NEElementwiseMin::NEElementwiseMin().

◆ operator=() [2/2]

NEElementwiseMin & operator= ( NEElementwiseMin &&  )
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 107 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.

108 {
109  ITensorPack pack;
110  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
111  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
112  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
113  _impl->op->run(pack);
114 }

◆ 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 min.

Parameters
[in]input1First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/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 101 of file NEElementwiseOperations.cpp.

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

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

102 {
103  ARM_COMPUTE_RETURN_ERROR_ON(act_info.enabled());
104  return cpu::CpuElementwiseMin::validate(input1, input2, output);
105 }
#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: