Compute Library
 19.08
CLDepthwiseSeparableConvolutionLayer Class Reference

Basic function to execute depthwise convolution. More...

#include <CLDepthwiseSeparableConvolutionLayer.h>

Collaboration diagram for CLDepthwiseSeparableConvolutionLayer:
[legend]

Public Member Functions

 CLDepthwiseSeparableConvolutionLayer ()
 Default constructor. More...
 
void configure (ICLTensor *input, const ICLTensor *depthwise_weights, const ICLTensor *depthwise_biases, ICLTensor *depthwise_out, const ICLTensor *pointwise_weights, const ICLTensor *pointwise_biases, ICLTensor *output, const PadStrideInfo &depthwise_conv_info, const PadStrideInfo &pointwise_conv_info)
 Set the input and output tensors. 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...
 

Detailed Description

Basic function to execute depthwise convolution.

This function calls the following OpenCL kernels and function:

  1. CLDepthwiseConvolutionLayer
  2. CLDirectConvolutionLayer

    Deprecated:
    This function is deprecated and will be removed in release 19.11

Definition at line 48 of file CLDepthwiseSeparableConvolutionLayer.h.

Constructor & Destructor Documentation

◆ CLDepthwiseSeparableConvolutionLayer()

Default constructor.

Definition at line 33 of file CLDepthwiseSeparableConvolutionLayer.cpp.

34  : _depthwise_conv(), _pointwise_conv()
35 {
36 }

Member Function Documentation

◆ configure()

void configure ( ICLTensor input,
const ICLTensor depthwise_weights,
const ICLTensor depthwise_biases,
ICLTensor depthwise_out,
const ICLTensor pointwise_weights,
const ICLTensor pointwise_biases,
ICLTensor output,
const PadStrideInfo depthwise_conv_info,
const PadStrideInfo pointwise_conv_info 
)

Set the input and output tensors.

Parameters
[in]inputSource tensor. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: F32.
[in]depthwise_weightsDepthwise convolution weights tensor. These are 3D tensors with dimensions [kernel_x, kernel_y, IFM]. Data type supported: Same as input.
[in]depthwise_biases(Optional) Biases tensor.Biases are 1D tensor with dimensions [IFM]. Must be nullptr if not needed. Data type supported: Same as weights.
[out]depthwise_outDepthwise destination tensor.
[in]pointwise_weightsPointwise convolution weights tensor. These are 4D tensors with dimensions [1, 1, IFM, OFM]. Data type supported: Same as input.
[in]pointwise_biases(Optional) Biases tensor. Biases are 1D tensor with dimensions [OFM]. Must be nullptr if not needed. Data type supported: Same as weights.
[out]outputDestination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. Data types supported: Same as input.
[in]depthwise_conv_infoContains padding and stride information described in PadStrideInfo for depthwise convolution.
[in]pointwise_conv_infoContains padding and stride information described in PadStrideInfo for pointwise convolution.

Definition at line 38 of file CLDepthwiseSeparableConvolutionLayer.cpp.

41 {
42  _depthwise_conv.configure(input, depthwise_weights, depthwise_biases, depthwise_out, depthwise_conv_info);
43  _pointwise_conv.configure(depthwise_out, pointwise_weights, pointwise_biases, output, pointwise_conv_info);
44 }
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Set the input and output tensors.
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier=1, const ActivationLayerInfo &act_info=ActivationLayerInfo(), const Size2D &dilation=Size2D(1U, 1U))
Initialize the function's source, destination, weights and convolution information.

References CLDirectConvolutionLayer::configure(), and CLDepthwiseConvolutionLayer::configure().

◆ 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 54 of file CLDepthwiseSeparableConvolutionLayer.cpp.

55 {
56  _depthwise_conv.prepare();
57  _pointwise_conv.prepare();
58 }
void prepare() override
Prepare the function for executing.
virtual void prepare()
Prepare the function for executing.
Definition: IFunction.h:57

References IFunction::prepare(), and CLDepthwiseConvolutionLayer::prepare().

Referenced by CLDepthwiseSeparableConvolutionLayer::run().

◆ 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 46 of file CLDepthwiseSeparableConvolutionLayer.cpp.

47 {
48  prepare();
49 
50  _depthwise_conv.run();
51  _pointwise_conv.run();
52 }
void prepare() override
Prepare the function for executing.
void run() override
Run the kernels contained in the function.
void run() override
Run the kernels contained in the function.

References CLDepthwiseSeparableConvolutionLayer::prepare(), CLDirectConvolutionLayer::run(), and CLDepthwiseConvolutionLayer::run().


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