Compute Library
 21.02
GCPoolingLayer Class Reference

Basic function to simulate a pooling layer with the specified pooling operation. More...

#include <GCPoolingLayer.h>

Collaboration diagram for GCPoolingLayer:
[legend]

Public Member Functions

 GCPoolingLayer ()
 
void configure (IGCTensor *input, IGCTensor *output, const PoolingLayerInfo &pool_info, IGCTensor *indices=nullptr)
 Set the input and output tensors. More...
 
void run () override final
 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, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices=nullptr)
 Static function to check if given info will lead to a valid configuration of GCPoolingLayer. More...
 

Detailed Description

Basic function to simulate a pooling layer with the specified pooling operation.

This function calls the following OpenGL ES kernels:

  1. GCFillBorderKernel (executed if padding size is different from zero)
  2. GCPoolingLayerKernel
Deprecated:
This function is deprecated and is intended to be removed in 21.05 release

Definition at line 48 of file GCPoolingLayer.h.

Constructor & Destructor Documentation

◆ GCPoolingLayer()

Definition at line 32 of file GCPoolingLayer.cpp.

33  : _kernel(nullptr), _border_handler(), _shift_handler()
34 {
35 }

Member Function Documentation

◆ configure()

void configure ( IGCTensor input,
IGCTensor output,
const PoolingLayerInfo pool_info,
IGCTensor indices = nullptr 
)

Set the input and output tensors.

Parameters
[in,out]inputSource tensor. (Written to only when padding != 0) Data types supported: F16/F32.
[out]outputDestination tensor. Data types supported: Same as input.
[in]pool_infoContains pooling operation information described in PoolingLayerInfo.
[out]indices(optional) The indices of the maximal values. Data type supported: U32.

Definition at line 37 of file GCPoolingLayer.cpp.

References GCFillBorderKernel::configure(), GCTensorShiftKernel::configure(), arm_compute::CONSTANT, arm_compute::MAX, PoolingLayerInfo::pool_type, and arm_compute::REPLICATE.

38 {
39  // Configure pooling kernel
40  auto k = std::make_unique<GCPoolingLayerKernel>();
41  k->configure(input, output, pool_info, indices);
42  _kernel = std::move(k);
43 
44  // Configure border depending on operation required
45  BorderMode border_mode = (PoolingType::MAX == pool_info.pool_type) ? BorderMode::REPLICATE : BorderMode::CONSTANT;
46  _border_handler.configure(input, _kernel->border_size(), border_mode, PixelValue(0.0f));
47 
48  _shift_handler.configure(input);
49 }
BorderMode
Methods available to handle borders.
Definition: Types.h:265
void configure(const IGCTensor *tensor, BorderSize border_size, BorderMode border_mode, const PixelValue &constant_border_value=PixelValue())
Initialise the kernel&#39;s input, output and border mode.
Pixels outside the image are assumed to have the same value as the closest image pixel.
void configure(IGCTensor *input)
Set the input of the kernel.

◆ run()

void run ( )
finaloverridevirtual

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 56 of file GCPoolingLayer.cpp.

References GCScheduler::dispatch(), GCScheduler::get(), and GCScheduler::memory_barrier().

57 {
58  GCScheduler::get().dispatch(_shift_handler, false);
60  GCScheduler::get().dispatch(_border_handler, false);
62  GCScheduler::get().dispatch(*_kernel);
63 }
void dispatch(IGCKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
Definition: GCScheduler.cpp:77
void memory_barrier()
Defines a barrier ordering memory transactions.
Definition: GCScheduler.cpp:86
static GCScheduler & get()
Access the scheduler singleton.
Definition: GCScheduler.cpp:70

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const PoolingLayerInfo pool_info,
const ITensorInfo indices = nullptr 
)
static

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

Parameters
[in]inputSource tensor info. Data types supported: F16/F32.
[in]outputDestination tensor info. Data types supported: Same as input.
[in]pool_infoContains pooling operation information described in PoolingLayerInfo.
[in]indices(optional) The indices of the maximal values. Data type supported: U32.
Returns
a status

Definition at line 51 of file GCPoolingLayer.cpp.

References GCPoolingLayerKernel::validate().

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

52 {
53  return GCPoolingLayerKernel::validate(input, output, pool_info, indices);
54 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PoolingLayerInfo &pool_info, const ITensorInfo *indices=nullptr)
Static function to check if given info will lead to a valid configuration of GCPoolingLayerKernel.

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