Compute Library
 21.02
CLElementwiseMin Class Reference

Basic function to run opencl::kernels::ClArithmeticKernel for min. More...

#include <CLElementwiseOperations.h>

Collaboration diagram for CLElementwiseMin:
[legend]

Public Member Functions

 CLElementwiseMin ()
 Default Constructor. More...
 
 ~CLElementwiseMin ()
 Default Destructor. More...
 
 CLElementwiseMin (const CLElementwiseMin &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLElementwiseMin (CLElementwiseMin &&)
 Default move constructor. More...
 
CLElementwiseMinoperator= (const CLElementwiseMin &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLElementwiseMinoperator= (CLElementwiseMin &&)
 Default move assignment operator. More...
 
void configure (ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info=ActivationLayerInfo())
 Initialise the kernel's inputs, output and conversion policy. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *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 opencl::kernels::ClArithmeticKernel for min. More...
 

Detailed Description

Basic function to run opencl::kernels::ClArithmeticKernel for min.

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

Definition at line 373 of file CLElementwiseOperations.h.

Constructor & Destructor Documentation

◆ CLElementwiseMin() [1/3]

Default Constructor.

Definition at line 227 of file CLElementwiseOperations.cpp.

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

228  : _impl(std::make_unique<Impl>())
229 {
230 }

◆ ~CLElementwiseMin()

~CLElementwiseMin ( )
default

Default Destructor.

Referenced by CLElementwiseMin::CLElementwiseMin().

◆ CLElementwiseMin() [2/3]

CLElementwiseMin ( const CLElementwiseMin )
delete

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

◆ CLElementwiseMin() [3/3]

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

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

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

Parameters
[in,out]input1First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[in,out]input2Second tensor input. Data types supported: same as input1. The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[out]outputOutput tensor. Data types supported: same as input1.
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 235 of file CLElementwiseOperations.cpp.

References CLKernelLibrary::get().

236 {
237  configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output, act_info);
238 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Initialise the kernel&#39;s inputs, output and conversion policy.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input1,
ICLTensor input2,
ICLTensor output,
const ActivationLayerInfo act_info = ActivationLayerInfo() 
)

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

Parameters
[in]compile_contextThe compile context to be used.
[in,out]input1First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[in,out]input2Second tensor input. Data types supported: same as input1. The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
[out]outputOutput tensor. Data types supported: same as input1.
[in]act_info(Optional) Activation layer information in case of a fused activation.

Definition at line 240 of file CLElementwiseOperations.cpp.

References ITensor::info().

241 {
242  _impl->src_0 = input1;
243  _impl->src_1 = input2;
244  _impl->dst = output;
245  _impl->op = std::make_unique<opencl::ClElementwiseMin>();
246  _impl->op->configure(compile_context, input1->info(), input2->info(), output->info(), act_info);
247 }

◆ operator=() [1/2]

CLElementwiseMin& operator= ( const CLElementwiseMin )
delete

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

Referenced by CLElementwiseMin::CLElementwiseMin().

◆ operator=() [2/2]

CLElementwiseMin & operator= ( CLElementwiseMin &&  )
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 254 of file CLElementwiseOperations.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.

255 {
256  ITensorPack pack;
257  pack.add_tensor(TensorType::ACL_SRC_0, _impl->src_0);
258  pack.add_tensor(TensorType::ACL_SRC_1, _impl->src_1);
259  pack.add_tensor(TensorType::ACL_DST, _impl->dst);
260 
261  _impl->op->run(pack);
262 }

◆ 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 opencl::kernels::ClArithmeticKernel for min.

Parameters
[in]input1First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/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.
Returns
a status

Definition at line 249 of file CLElementwiseOperations.cpp.

References ClElementwiseMin::validate().

250 {
251  return opencl::ClElementwiseMin::validate(input1, input2, output, act_info);
252 }
static Status validate(const ITensorInfo *src1, const ITensorInfo *src2, const ITensorInfo *dst, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration of opencl::kernels::ClArith...

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