Compute Library
 19.11
CLArgMinMaxLayer Class Reference

Function to calculate the index of the minimum or maximum values in a tensor based on an axis. More...

#include <CLArgMinMaxLayer.h>

Collaboration diagram for CLArgMinMaxLayer:
[legend]

Public Member Functions

 CLArgMinMaxLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Default Constructor. More...
 
void configure (ICLTensor *input, int axis, ICLTensor *output, const ReductionOperation &op)
 Set the input and output tensors. 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 *input, int axis, const ITensorInfo *output, const ReductionOperation &op)
 Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayer. More...
 

Detailed Description

Function to calculate the index of the minimum or maximum values in a tensor based on an axis.

Note
The default data type for an uninitialized output tensor is signed 32-bit integer (S32). It is the user's responsibility to check that the results do not overflow because the indices are computed in unsigned 32-bit (U32).

Definition at line 46 of file CLArgMinMaxLayer.h.

Constructor & Destructor Documentation

◆ CLArgMinMaxLayer()

CLArgMinMaxLayer ( std::shared_ptr< IMemoryManager memory_manager = nullptr)

Default Constructor.

Parameters
[in]memory_manager(Optional) Memory manager.

Definition at line 35 of file CLArgMinMaxLayer.cpp.

36  : _reduction_function(support::cpp14::make_unique<CLReductionOperation>(std::move(memory_manager)))
37 {
38 }

Member Function Documentation

◆ configure()

void configure ( ICLTensor input,
int  axis,
ICLTensor output,
const ReductionOperation op 
)

Set the input and output tensors.

Parameters
[in]inputInput source tensor, this could be written if CLReductionOperation manipulates its border for better performance. Data types supported: F16/F32.
[in]axisAxis to find max/min index.
[out]outputOutput source tensor. Data types supported: U32/S32.
[in]opOperation to perform: min or max

Definition at line 40 of file CLArgMinMaxLayer.cpp.

41 {
42  _reduction_function->configure(input, output, axis, op, false);
43 }

References arm_compute::test::validation::axis, and arm_compute::test::validation::input.

◆ 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 51 of file CLArgMinMaxLayer.cpp.

52 {
53  _reduction_function->run();
54 }

◆ validate()

Status validate ( const ITensorInfo input,
int  axis,
const ITensorInfo output,
const ReductionOperation op 
)
static

Static function to check if given info will lead to a valid configuration of CLArgMinMaxLayer.

Parameters
[in]inputInput source tensor info. Data types supported: F16/F32.
[in]axisAxis to find max/min index.
[in]outputOutput source tensor info. Data types supported: U32/S32.
[in]opOperation to perform: min or max
Returns
a status

Definition at line 45 of file CLArgMinMaxLayer.cpp.

46 {
48  return CLReductionOperation::validate(input, output, axis, op, false);
49 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, ReductionOperation op, bool keep_dims=true)
Static function to check if given info will lead to a valid configuration of CLReductionOperation.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Definition: Error.h:244

References arm_compute::ARG_IDX_MAX, arm_compute::ARG_IDX_MIN, ARM_COMPUTE_RETURN_ERROR_ON_MSG, arm_compute::test::validation::axis, arm_compute::test::validation::input, and CLReductionOperation::validate().


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