Compute Library
 19.11
NEArgMinMaxLayer Class Reference

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

#include <NEArgMinMaxLayer.h>

Collaboration diagram for NEArgMinMaxLayer:
[legend]

Public Member Functions

 NEArgMinMaxLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Constructor. More...
 
void configure (ITensor *input, int axis, ITensor *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 NEArgMinMaxLayer. More...
 

Detailed Description

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

This function calls the following NEON kernels:

  1. NEReductionOperationKernel
  2. NEFillBorderKernel
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 50 of file NEArgMinMaxLayer.h.

Constructor & Destructor Documentation

◆ NEArgMinMaxLayer()

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

Constructor.

Definition at line 35 of file NEArgMinMaxLayer.cpp.

36  : _reduction_function(support::cpp14::make_unique<NEReductionOperation>())
37 {
38  ARM_COMPUTE_UNUSED(memory_manager);
39 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

References ARM_COMPUTE_UNUSED.

Member Function Documentation

◆ configure()

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

Set the input and output tensors.

Parameters
[in]inputInput source tensor. Data types supported: QASYMM8/S32/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 NEArgMinMaxLayer.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 NEArgMinMaxLayer.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 NEArgMinMaxLayer.

Parameters
[in]inputInput source tensor info. Data types supported: QASYMM8/S32/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 NEArgMinMaxLayer.cpp.

46 {
48  return NEReductionOperation::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 NEReductionOperation.
#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 NEReductionOperation::validate().


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