Compute Library
 21.02
CLPoolingLayer Class Reference

Basic function to run opencl::ClPooling. More...

#include <CLPoolingLayer.h>

Collaboration diagram for CLPoolingLayer:
[legend]

Public Member Functions

 CLPoolingLayer ()
 Default Constructor. More...
 
 ~CLPoolingLayer ()
 Default Destructor. More...
 
 CLPoolingLayer (const CLPoolingLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLPoolingLayer (CLPoolingLayer &&)=default
 Default move constructor. More...
 
CLPoolingLayeroperator= (const CLPoolingLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLPoolingLayeroperator= (CLPoolingLayer &&)=default
 Default move assignment operator. More...
 
void configure (ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info, ICLTensor *indices=nullptr)
 Set the input and output tensors. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info, ICLTensor *indices=nullptr)
 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, 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 CLPoolingLayer. More...
 

Detailed Description

Basic function to run opencl::ClPooling.

Definition at line 40 of file CLPoolingLayer.h.

Constructor & Destructor Documentation

◆ CLPoolingLayer() [1/3]

Default Constructor.

Definition at line 41 of file CLPoolingLayer.cpp.

References CLPoolingLayer::~CLPoolingLayer().

42  : _impl(std::make_unique<Impl>())
43 {
44 }

◆ ~CLPoolingLayer()

~CLPoolingLayer ( )
default

Default Destructor.

Referenced by CLPoolingLayer::CLPoolingLayer().

◆ CLPoolingLayer() [2/3]

CLPoolingLayer ( const CLPoolingLayer )
delete

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

◆ CLPoolingLayer() [3/3]

CLPoolingLayer ( CLPoolingLayer &&  )
default

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

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

Set the input and output tensors.

Parameters
[in,out]inputSource tensor. (Written to only when padding != 0) Data types supported: QASYMM8/QASYMM8_SIGNED/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 47 of file CLPoolingLayer.cpp.

References CLKernelLibrary::get().

48 {
49  configure(CLKernelLibrary::get().get_compile_context(), input, output, pool_info, indices);
50 }
void configure(ICLTensor *input, ICLTensor *output, const PoolingLayerInfo &pool_info, ICLTensor *indices=nullptr)
Set the input and output tensors.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input,
ICLTensor output,
const PoolingLayerInfo pool_info,
ICLTensor indices = nullptr 
)

Set the input and output tensors.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]inputSource tensor. (Written to only when padding != 0) Data types supported: QASYMM8/QASYMM8_SIGNED/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 52 of file CLPoolingLayer.cpp.

References ITensor::info(), and arm_compute::test::validation::input.

53 {
54  _impl->src = input;
55  _impl->dst = output;
56  _impl->indices = indices;
57 
58  _impl->op = std::make_unique<opencl::ClPooling>();
59  _impl->op->configure(compile_context, input->info(), output->info(), pool_info, (indices) ? indices->info() : nullptr);
60 }

◆ operator=() [1/2]

CLPoolingLayer& operator= ( const CLPoolingLayer )
delete

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

◆ operator=() [2/2]

CLPoolingLayer& operator= ( CLPoolingLayer &&  )
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 67 of file CLPoolingLayer.cpp.

References arm_compute::ACL_DST_0, arm_compute::ACL_DST_1, arm_compute::ACL_SRC, and ITensorPack::add_tensor().

68 {
69  ITensorPack pack;
70  pack.add_tensor(TensorType::ACL_SRC, _impl->src);
71  pack.add_tensor(TensorType::ACL_DST_0, _impl->dst);
72  pack.add_tensor(TensorType::ACL_DST_1, _impl->indices);
73  _impl->op->run(pack);
74 }

◆ 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 CLPoolingLayer.

Parameters
[in]inputSource tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/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 62 of file CLPoolingLayer.cpp.

References ClPooling::validate().

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

63 {
64  return opencl::ClPooling::validate(input, output, pool_info, indices);
65 }
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const PoolingLayerInfo &info, const ITensorInfo *indices=nullptr)
Static function to check if given info will lead to a valid configuration of ClPooling.
Definition: ClPooling.cpp:88

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