Compute Library
 21.02
NEElementwiseComparison Class Reference

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

#include <NEElementwiseOperations.h>

Collaboration diagram for NEElementwiseComparison:
[legend]

Public Member Functions

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

Detailed Description

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

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

Definition at line 276 of file NEElementwiseOperations.h.

Constructor & Destructor Documentation

◆ NEElementwiseComparison() [1/3]

Default Constructor.

Definition at line 294 of file NEElementwiseOperations.cpp.

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

295  : _impl(std::make_unique<Impl>())
296 {
297 }

◆ ~NEElementwiseComparison()

Default Destructor.

Referenced by NEElementwiseComparison::NEElementwiseComparison().

◆ NEElementwiseComparison() [2/3]

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

◆ NEElementwiseComparison() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( ITensor input1,
ITensor input2,
ITensor output,
ComparisonOperation  op 
)

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

Parameters
[in,out]input1First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
[in,out]input2Second tensor input. Data types supported: Same as input1.
[out]outputOutput tensor. Data types supported: U8.
[in]opComparison Operation to be performed.

Definition at line 302 of file NEElementwiseOperations.cpp.

References ITensor::info().

303 {
304  _impl->src_0 = input1;
305  _impl->src_1 = input2;
306  _impl->dst = output;
307  _impl->op = std::make_unique<cpu::CpuElementwiseComparison>();
308  _impl->op->configure(input1->info(), input2->info(), output->info(), op);
309 }

◆ operator=() [1/2]

NEElementwiseComparison& operator= ( const NEElementwiseComparison )
delete

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

Referenced by NEElementwiseComparison::NEElementwiseComparison().

◆ operator=() [2/2]

NEElementwiseComparison & operator= ( NEElementwiseComparison &&  )
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 316 of file NEElementwiseOperations.cpp.

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

317 {
318  ITensorPack pack;
319  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
320  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
321  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
322  _impl->op->run(pack);
323 }

◆ validate()

Status validate ( const ITensorInfo input1,
const ITensorInfo input2,
const ITensorInfo output,
ComparisonOperation  op 
)
static

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

Parameters
[in]input1First tensor input info. Data types supported: U8/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: U8.
[in]opComparison Operation to be performed.
Returns
a status

Definition at line 311 of file NEElementwiseOperations.cpp.

References CpuElementwiseComparison::validate().

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

312 {
313  return cpu::CpuElementwiseComparison::validate(input1, input2, output, op);
314 }
static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ComparisonOperation op)
Static function to check if given info will lead to a valid configuration of cpu::kernels::CpuCompari...

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