Compute Library
 19.11
CLDepthwiseConvolutionLayer3x3 Class Reference

Basic function to execute a depthwise convolution for kernel size 3x3xC (when data layout NCHW) or Cx3x3 (when data layout NHWC). More...

#include <CLDepthwiseConvolutionLayer.h>

Collaboration diagram for CLDepthwiseConvolutionLayer3x3:
[legend]

Public Member Functions

 CLDepthwiseConvolutionLayer3x3 (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Default constructor. More...
 
 CLDepthwiseConvolutionLayer3x3 (const CLDepthwiseConvolutionLayer3x3 &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLDepthwiseConvolutionLayer3x3 (CLDepthwiseConvolutionLayer3x3 &&)=default
 Default move constructor. More...
 
CLDepthwiseConvolutionLayer3x3operator= (const CLDepthwiseConvolutionLayer3x3 &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLDepthwiseConvolutionLayer3x3operator= (CLDepthwiseConvolutionLayer3x3 &&)=default
 Default move assignment operator. More...
 
void configure (ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier=1, ActivationLayerInfo act_info=ActivationLayerInfo(), const Size2D &dilation=Size2D(1U, 1U))
 Initialize the function's source, destination, conv and border_size. More...
 
void run () override
 Run the kernels contained in the function. More...
 
void prepare () override
 Prepare the function for executing. More...
 
- Public Member Functions inherited from IFunction
virtual ~IFunction ()=default
 Destructor. More...
 

Static Public Member Functions

static Status validate (const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier=1, ActivationLayerInfo act_info=ActivationLayerInfo(), GPUTarget gpu_target=GPUTarget::MIDGARD, const Size2D &dilation=Size2D(1U, 1U))
 Static function to check if given info will lead to a valid configuration of CLDepthwiseConvolutionLayer3x3. More...
 

Detailed Description

Basic function to execute a depthwise convolution for kernel size 3x3xC (when data layout NCHW) or Cx3x3 (when data layout NHWC).

This function calls the following OpenCL kernels:

  1. CLDepthwiseConvolutionLayer3x3NCHWKernel (if data_layout == NCHW)
  2. CLDepthwiseConvolutionLayer3x3NHWCKernel (if data_layout == NHWC)
  3. CLDepthwiseConvolutionLayerReshapeWeightsKernel (if data_layout == NHWC)
  4. CLFillBorderKernel (if pad_x or pad_y > 0)

Definition at line 302 of file CLDepthwiseConvolutionLayer.h.

Constructor & Destructor Documentation

◆ CLDepthwiseConvolutionLayer3x3() [1/3]

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

Default constructor.

Definition at line 120 of file CLDepthwiseConvolutionLayer.cpp.

121  : _func(std::move(memory_manager))
122 {
123 }

◆ CLDepthwiseConvolutionLayer3x3() [2/3]

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

◆ CLDepthwiseConvolutionLayer3x3() [3/3]

Default move constructor.

Member Function Documentation

◆ configure()

void configure ( ICLTensor input,
const ICLTensor weights,
const ICLTensor biases,
ICLTensor output,
const PadStrideInfo conv_info,
unsigned int  depth_multiplier = 1,
ActivationLayerInfo  act_info = ActivationLayerInfo(),
const Size2D dilation = Size2D(1U, 1U) 
)

Initialize the function's source, destination, conv and border_size.

Parameters
[in,out]inputSource tensor. Data type supported: QASYMM8/F16/F32. (Written to only for border filling).
[in]weightsWeights tensor. A 3D tensor with shape [3, 3, IFM]. Data type supported: Same as input or QASYMM8/QSYMM8_PER_CHANNEL when input is QASYMM8.
[in]biasesBiases tensor. A 1D tensor with shape [IFM]. Must be nullptr if not needed. Data type supported: Same as input.
[out]outputDestination tensor. Data type supported: same as input.
[in]conv_infoPadding and stride information to use for the convolution.
[in]depth_multiplier(Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
[in]act_info(Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU for 3x3 QASYMM8 supported.
[in]dilation(Optional) Dilation, in elements, across x and y. Defaults to (1, 1).

Definition at line 125 of file CLDepthwiseConvolutionLayer.cpp.

127 {
128  _func.configure(input, weights, biases, output, conv_info, depth_multiplier, act_info, dilation);
129 }
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier=1, ActivationLayerInfo act_info=ActivationLayerInfo(), const Size2D &dilation=Size2D(1U, 1U))
Initialize the function's source, destination, weights and convolution information.

References arm_compute::test::validation::act_info, CLDepthwiseConvolutionLayer::configure(), arm_compute::test::validation::conv_info, arm_compute::test::validation::dilation, arm_compute::test::validation::input, and arm_compute::test::validation::weights.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Default move assignment operator.

◆ prepare()

void prepare ( )
overridevirtual

Prepare the function for executing.

Any one off pre-processing step required by the function is handled here

Note
Prepare stage might not need all the function's buffers' backing memory to be available in order to execute

Reimplemented from IFunction.

Definition at line 142 of file CLDepthwiseConvolutionLayer.cpp.

143 {
144  _func.prepare();
145 }
void prepare() override
Prepare the function for executing.

References CLDepthwiseConvolutionLayer::prepare().

◆ 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 137 of file CLDepthwiseConvolutionLayer.cpp.

138 {
139  _func.run();
140 }
void run() override
Run the kernels contained in the function.

References CLDepthwiseConvolutionLayer::run().

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo weights,
const ITensorInfo biases,
const ITensorInfo output,
const PadStrideInfo conv_info,
unsigned int  depth_multiplier = 1,
ActivationLayerInfo  act_info = ActivationLayerInfo(),
GPUTarget  gpu_target = GPUTarget::MIDGARD,
const Size2D dilation = Size2D(1U, 1U) 
)
static

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

Parameters
[in]inputSource tensor info. Data type supported: QASYMM8 for all layouts, F16/F32 for NCHW.
[in]weightsWeights tensor info. A 3D tensor with shape [3, 3, IFM]. Data type supported: Same as input or QASYMM8/QSYMM8_PER_CHANNEL when input is QASYMM8.
[in]biasesBiases tensor info. A 1D tensor with shape [IFM]. Must be nullptr if not needed. Data type supported: Same as input, S32 when input is QASYMM8.
[in]outputDestination tensor. Data type supported: same as input.
[in]conv_infoPadding and stride information to use for the convolution.
[in]depth_multiplier(Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
[in]act_info(Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU for 3x3 QASYMM8 supported.
[in]gpu_target(Optional) GPU target to validate the kernel for. Defaults to midgard.
[in]dilation(Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
Returns
a status

Definition at line 131 of file CLDepthwiseConvolutionLayer.cpp.

References arm_compute::test::validation::act_info, arm_compute::test::validation::conv_info, arm_compute::test::validation::dilation, arm_compute::test::validation::input, and arm_compute::test::validation::weights.


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