Compute Library
 21.02
CLDeconvolutionLayerUpsample Class Reference

Basic function to execute deconvolution upsample on OpenCL. More...

#include <CLDeconvolutionLayerUpsample.h>

Collaboration diagram for CLDeconvolutionLayerUpsample:
[legend]

Public Member Functions

 CLDeconvolutionLayerUpsample ()
 Default constructor. More...
 
 CLDeconvolutionLayerUpsample (const CLDeconvolutionLayerUpsample &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLDeconvolutionLayerUpsampleoperator= (const CLDeconvolutionLayerUpsample &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLDeconvolutionLayerUpsample (CLDeconvolutionLayerUpsample &&)=default
 Allow instances of this class to be moved. More...
 
CLDeconvolutionLayerUpsampleoperator= (CLDeconvolutionLayerUpsample &&)=default
 Allow instances of this class to be moved. More...
 
 ~CLDeconvolutionLayerUpsample ()
 Default destructor. More...
 
void configure (ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
 Initialize the function's source, destination, interpolation type and border_mode. More...
 
void configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
 Initialize the function's source, destination, interpolation type and border_mode. 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 PadStrideInfo &info)
 Static function to check if given info will lead to a valid configuration of CLDeconvolutionLayerUpsample. More...
 

Detailed Description

Basic function to execute deconvolution upsample on OpenCL.

This function calls the following OpenCL kernels and functions:

  1. CLFill
  2. CLDeconvolutionLayerUpsampleKernel

Definition at line 46 of file CLDeconvolutionLayerUpsample.h.

Constructor & Destructor Documentation

◆ CLDeconvolutionLayerUpsample() [1/3]

Default constructor.

Definition at line 34 of file CLDeconvolutionLayerUpsample.cpp.

35  : _upsample(std::make_unique<CLDeconvolutionLayerUpsampleKernel>()),
36  _fill(),
37  _output(nullptr)
38 {
39 }

◆ CLDeconvolutionLayerUpsample() [2/3]

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

◆ CLDeconvolutionLayerUpsample() [3/3]

Allow instances of this class to be moved.

◆ ~CLDeconvolutionLayerUpsample()

Default destructor.

Member Function Documentation

◆ configure() [1/2]

void configure ( ICLTensor input,
ICLTensor output,
const PadStrideInfo info 
)

Initialize the function's source, destination, interpolation type and border_mode.

Parameters
[in,out]inputSource tensor. Data type supported: All.
[out]outputDestination tensor. Data type supported: same as input.
[in]infoContains padding and policies to be used in the deconvolution.

Definition at line 48 of file CLDeconvolutionLayerUpsample.cpp.

References CLKernelLibrary::get().

Referenced by CLDirectDeconvolutionLayer::configure().

49 {
50  configure(CLKernelLibrary::get().get_compile_context(), input, output, info);
51 }
void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
Initialize the function&#39;s source, destination, interpolation type and border_mode.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
ICLTensor input,
ICLTensor output,
const PadStrideInfo info 
)

Initialize the function's source, destination, interpolation type and border_mode.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]inputSource tensor. Data type supported: All.
[out]outputDestination tensor. Data type supported: same as input.
[in]infoContains padding and policies to be used in the deconvolution.

Definition at line 53 of file CLDeconvolutionLayerUpsample.cpp.

References ARM_COMPUTE_ERROR_ON_NULLPTR, CLFill::configure(), ITensorInfo::data_type(), ITensor::info(), and ITensorInfo::quantization_info().

54 {
56 
57  _output = output;
58  _fill.configure(compile_context, _output, PixelValue(0, _output->info()->data_type(), _output->info()->quantization_info()));
59  _upsample->configure(compile_context, input, _output, info);
60 }
virtual DataType data_type() const =0
Data type used for each element of the tensor.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
void configure(ICLTensor *tensor, const PixelValue &constant_value, Window *window=nullptr)
Initialize the kernel&#39;s tensor and filling value.
Definition: CLFill.cpp:52
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Allow instances of this class to be moved.

◆ 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 62 of file CLDeconvolutionLayerUpsample.cpp.

References CLScheduler::enqueue(), CLScheduler::get(), and CLFill::run().

Referenced by CLDirectDeconvolutionLayer::run().

63 {
64  _fill.run();
65  CLScheduler::get().enqueue(*_upsample, true);
66 }
static CLScheduler & get()
Access the scheduler singleton.
void run() override
Run the kernels contained in the function.
Definition: CLFill.cpp:72
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo output,
const PadStrideInfo info 
)
static

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

Parameters
[in]inputSource tensor info. Data type supported: All.
[in]outputDestination tensor info. Data type supported: same as input.
[in]infoContains padding and policies to be used in the deconvolution.
Returns
a status

Definition at line 43 of file CLDeconvolutionLayerUpsample.cpp.

References CLDeconvolutionLayerUpsampleKernel::validate().

Referenced by CLDirectDeconvolutionLayer::validate().

44 {
46 }
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info)
Static function to check if given info will lead to a valid configuration of CLDeconvolutionLayerUpsa...
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

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