Compute Library
 23.08
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 334 of file NEElementwiseOperations.h.

Constructor & Destructor Documentation

◆ NEElementwiseComparison() [1/3]

Default Constructor.

Definition at line 294 of file NEElementwiseOperations.cpp.

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

◆ ~NEElementwiseComparison()

Default Destructor.

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

Valid data layouts:

  • All

Valid data type configurations:

src0 src1 dst
QASYMM8 QASYMM8 U8
QASYMM8_SIGNED QASYMM8_SIGNED U8
S32 S32 U8
U8 U8 U8
S16 S16 U8
F16 F16 U8
F32 F32 U8
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.

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 }

References ITensor::info().

◆ operator=() [1/2]

NEElementwiseComparison& operator= ( const NEElementwiseComparison )
delete

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

◆ operator=() [2/2]

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

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 }

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

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

312 {
313  return cpu::CpuElementwiseComparison::validate(input1, input2, output, op);
314 }

References CpuElementwiseComparison::validate().


The documentation for this class was generated from the following files:
arm_compute::ITensorPack::add_tensor
void add_tensor(int id, ITensor *tensor)
Add tensor to the pack.
Definition: ITensorPack.cpp:39
arm_compute::ACL_SRC_0
@ ACL_SRC_0
Definition: Types.h:45
arm_compute::ACL_SRC_1
@ ACL_SRC_1
Definition: Types.h:46
arm_compute::ACL_DST
@ ACL_DST
Definition: Types.h:55
arm_compute::cpu::CpuElementwiseComparison::validate
static Status validate(const ITensorInfo *src0, const ITensorInfo *src1, const ITensorInfo *dst, ComparisonOperation op)
Static function to check if given info will lead to a valid configuration.
Definition: CpuElementwise.cpp:117
arm_compute::test::validation::pack
ITensorPack pack
Definition: Im2Col.cpp:188