Compute Library
 19.08
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)
 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)
 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

Definition at line 45 of file GCPoolingLayer.h.

Constructor & Destructor Documentation

◆ GCPoolingLayer()

Definition at line 34 of file GCPoolingLayer.cpp.

35  : _kernel(nullptr), _border_handler(), _shift_handler()
36 {
37 }

Member Function Documentation

◆ configure()

void configure ( IGCTensor input,
IGCTensor output,
const PoolingLayerInfo pool_info 
)

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.

Definition at line 39 of file GCPoolingLayer.cpp.

40 {
41  // Configure pooling kernel
42  auto k = arm_compute::support::cpp14::make_unique<GCPoolingLayerKernel>();
43  k->configure(input, output, pool_info);
44  _kernel = std::move(k);
45 
46  // Configure border depending on operation required
48  _border_handler.configure(input, _kernel->border_size(), border_mode, PixelValue(0.0f));
49 
50  _shift_handler.configure(input);
51 }
BorderMode
Methods available to handle borders.
Definition: Types.h:251
Class describing the value of a pixel for any image format.
Definition: PixelValue.h:34
void configure(const IGCTensor *tensor, BorderSize border_size, BorderMode border_mode, const PixelValue &constant_border_value=PixelValue())
Initialise the kernel's input, output and border mode.
Pixels outside the image are assumed to have the same value as the closest image pixel.
PoolingType pool_type() const
Get the pooling type.
Definition: Types.h:1242
void configure(IGCTensor *input)
Set the input of the kernel.

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

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

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

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

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const PoolingLayerInfo pool_info 
)
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.
Returns
a status

Definition at line 53 of file GCPoolingLayer.cpp.

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

References GCPoolingLayerKernel::validate().


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