clDNN
cldnn::convolution Struct Reference

Performs forward spatial convolution with weight sharing. Also supports built-in Relu cldnn_activation_desc available by setting it in arguments. More...

#include <convolution.hpp>

Inheritance diagram for cldnn::convolution:
Collaboration diagram for cldnn::convolution:

Public Types

typedef cldnn_convolution_desc dto
 

Public Member Functions

 convolution (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, const std::vector< primitive_id > &bias, tensor stride={ 1, 1, 1, 1 }, tensor input_offset={ 0, 0, 0, 0 }, tensor dilation={ 1, 1, 1, 1 }, bool with_activation=false, float activation_slp=0.0f, const padding &output_padding=padding())
 Constructs convolution primitive. More...
 
 convolution (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, tensor stride={ 1, 1, 1, 1 }, tensor input_offset={ 0, 0, 0, 0 }, tensor dilation={ 1, 1, 1, 1 }, bool with_activation=false, float activation_slp=0.0f, const padding &output_padding=padding())
 Constructs convolution primitive (w/o bias). More...
 
 convolution (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, const std::vector< primitive_id > &bias, tensor stride, tensor input_offset, tensor dilation, bool with_activation, float activation_slp, tensor output_size, const padding &output_padding=padding())
 Constructs convolution primitive (computes input paddings to match output size). More...
 
 convolution (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, tensor stride, tensor input_offset, tensor dilation, bool with_activation, float activation_slp, tensor output_size, const padding &output_padding=padding())
 Constructs convolution primitive (w/o bias; computes input paddings to match output size). More...
 
 convolution (const dto *dto)
 Constructs a copy from C API cldnn_convolution_desc.
 
int32_t split () const
 On how many cards split the computation to.
 
- Public Member Functions inherited from cldnn::primitive_base< convolution, cldnn_convolution_desc >
const cldnn_primitive_descget_dto () const override
 Returns pointer to a C API primitive descriptor casted to cldnn_primitive_desc.
 
- Public Member Functions inherited from cldnn::primitive
 primitive (const primitive_type_id &type, const primitive_id &id, const std::vector< primitive_id > &input, const padding &output_padding=padding())
 
 primitive (const cldnn_primitive_desc *dto)
 Constructs a copy from basic C API cldnn_primitive_desc.
 
std::vector< std::reference_wrapper< primitive_id > > dependecies ()
 Returns references to all primitive ids on which this primitive depends - inputs, weights, biases, etc.
 
std::vector< primitive_iddependecies () const
 Returns copy of all primitive ids on which this primitive depends - inputs, weights, biases, etc.
 
 operator primitive_id () const
 Implicit conversion to primiitive id.
 

Static Public Member Functions

static primitive_type_id type_id ()
 
static convolution create_with_output_size (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, const std::vector< primitive_id > &bias, tensor output_size, tensor stride={ 1, 1, 1, 1 }, tensor input_offset={ 0, 0, 0, 0 }, tensor dilation={ 1, 1, 1, 1 }, bool with_activation=false, float activation_slp=0.0f, const padding &output_padding=padding())
 Constructs convolution primitive (computes input paddings to match output size). More...
 
static convolution create_with_output_size (const primitive_id &id, const primitive_id &input, const std::vector< primitive_id > &weights, tensor output_size, tensor stride={ 1, 1, 1, 1 }, tensor input_offset={ 0, 0, 0, 0 }, tensor dilation={ 1, 1, 1, 1 }, bool with_activation=false, float activation_slp=0.0f, const padding &output_padding=padding())
 Constructs convolution primitive (w/o bias; computes input paddings to match output size). More...
 

Public Attributes

fixed_size_vector_ref weights
 List of primitive ids containing weights data.
 
fixed_size_vector_ref bias
 List of primitive ids containing bias data.
 
tensor input_offset
 Defines a shift, relative to (0,0) position of the input buffer, where (0,0) point of the convolution window should start calculations.
 
tensor stride
 Defines shift in input buffer between adjacent calculations of output values.
 
tensor dilation
 Defines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
 
bool with_activation
 Enable Relu activation.
 
float activation_negative_slope
 Relu activation slope.
 
bool with_output_size
 Indicates that the primitive has user-defined output size (non-zero value).
 
tensor output_size
 User-defined output data size of the primitive (w/o padding).
 
- Public Attributes inherited from cldnn::primitive
const primitive_type_id type
 Primitive's type id.
 
const primitive_id id
 Primitive's id.
 
fixed_size_vector_ref input
 List of ids of input primitives.
 
padding output_padding
 Requested output padding.
 

Protected Member Functions

std::vector< std::reference_wrapper< const primitive_id > > get_dependencies () const override
 
void update_dto (dto &dto) const override
 
- Protected Member Functions inherited from cldnn::primitive_base< convolution, cldnn_convolution_desc >
 primitive_base (const primitive_id &id, const std::vector< primitive_id > &input, const padding &output_padding=padding())
 
 primitive_base (const cldnn_convolution_desc *dto)
 

Protected Attributes

primitive_id_arr _weights
 
primitive_id_arr _bias
 
- Protected Attributes inherited from cldnn::primitive
primitive_id_arr _input
 

Detailed Description

Performs forward spatial convolution with weight sharing. Also supports built-in Relu cldnn_activation_desc available by setting it in arguments.

Parameters are defined in context of "direct" convolution, but actual algorithm is not implied.

Definition at line 34 of file convolution.hpp.

Constructor & Destructor Documentation

◆ convolution() [1/4]

cldnn::convolution::convolution ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
const std::vector< primitive_id > &  bias,
tensor  stride = { 1, 1, 1, 1 },
tensor  input_offset = { 0,0,0,0 },
tensor  dilation = { 1, 1, 1, 1 },
bool  with_activation = false,
float  activation_slp = 0.0f,
const padding output_padding = padding() 
)
inline

Constructs convolution primitive.

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
biasList of primitive ids containing bias data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.

Definition at line 50 of file convolution.hpp.

◆ convolution() [2/4]

cldnn::convolution::convolution ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
tensor  stride = { 1, 1, 1, 1 },
tensor  input_offset = { 0,0,0,0 },
tensor  dilation = { 1, 1, 1, 1 },
bool  with_activation = false,
float  activation_slp = 0.0f,
const padding output_padding = padding() 
)
inline

Constructs convolution primitive (w/o bias).

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.

Definition at line 89 of file convolution.hpp.

◆ convolution() [3/4]

cldnn::convolution::convolution ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
const std::vector< primitive_id > &  bias,
tensor  stride,
tensor  input_offset,
tensor  dilation,
bool  with_activation,
float  activation_slp,
tensor  output_size,
const padding output_padding = padding() 
)
inline

Constructs convolution primitive (computes input paddings to match output size).

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
biasList of primitive ids containing bias data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.
output_sizeUser-defined output data size of the primitive (w/o padding).

Definition at line 127 of file convolution.hpp.

◆ convolution() [4/4]

cldnn::convolution::convolution ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
tensor  stride,
tensor  input_offset,
tensor  dilation,
bool  with_activation,
float  activation_slp,
tensor  output_size,
const padding output_padding = padding() 
)
inline

Constructs convolution primitive (w/o bias; computes input paddings to match output size).

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.
output_sizeUser-defined output data size of the primitive (w/o padding).

Definition at line 169 of file convolution.hpp.

Member Function Documentation

◆ create_with_output_size() [1/2]

static convolution cldnn::convolution::create_with_output_size ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
const std::vector< primitive_id > &  bias,
tensor  output_size,
tensor  stride = { 1, 1, 1, 1 },
tensor  input_offset = { 0,0,0,0 },
tensor  dilation = { 1, 1, 1, 1 },
bool  with_activation = false,
float  activation_slp = 0.0f,
const padding output_padding = padding() 
)
inlinestatic

Constructs convolution primitive (computes input paddings to match output size).

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
biasList of primitive ids containing bias data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.
output_sizeUser-defined output data size of the primitive (w/o padding).
Returns
Convolution primitive with specified settings.

Definition at line 229 of file convolution.hpp.

◆ create_with_output_size() [2/2]

static convolution cldnn::convolution::create_with_output_size ( const primitive_id id,
const primitive_id input,
const std::vector< primitive_id > &  weights,
tensor  output_size,
tensor  stride = { 1, 1, 1, 1 },
tensor  input_offset = { 0,0,0,0 },
tensor  dilation = { 1, 1, 1, 1 },
bool  with_activation = false,
float  activation_slp = 0.0f,
const padding output_padding = padding() 
)
inlinestatic

Constructs convolution primitive (w/o bias; computes input paddings to match output size).

Parameters
idThis primitive id.
inputInput primitive id.
weightsList of primitive ids containing weights data.
input_offsetInput padding/offset.
strideDefines shift in input buffer between adjacent calculations of output values.
dilationDefines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4].
with_activationEnable Relu activation.
activation_slpRelu activation slope.
output_sizeUser-defined output data size of the primitive (w/o padding).
Returns
Convolution primitive with specified settings.

Definition at line 260 of file convolution.hpp.


The documentation for this struct was generated from the following file: