Convolution¶
Overview¶
A primitive to perform 1D, 2D or 3D convolution. More…
// structs struct dnnl::convolution_backward_data; struct dnnl::convolution_backward_weights; struct dnnl::convolution_forward; // global functions dnnl_status_t DNNL_API dnnl_convolution_forward_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t src_desc, const_dnnl_memory_desc_t weights_desc, const_dnnl_memory_desc_t bias_desc, const_dnnl_memory_desc_t dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_attr_t attr ); dnnl_status_t DNNL_API dnnl_convolution_backward_data_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t diff_src_desc, const_dnnl_memory_desc_t weights_desc, const_dnnl_memory_desc_t diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_desc_t hint_fwd_pd, const_dnnl_primitive_attr_t attr ); dnnl_status_t DNNL_API dnnl_convolution_backward_weights_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t src_desc, const_dnnl_memory_desc_t diff_weights_desc, const_dnnl_memory_desc_t diff_bias_desc, const_dnnl_memory_desc_t diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_desc_t hint_fwd_pd, const_dnnl_primitive_attr_t attr );
Detailed Documentation¶
A primitive to perform 1D, 2D or 3D convolution.
Supported variants are forward propagation, backward propagation, and weights gradient with or without bias.
See also:
Convolution in developer guide
Global Functions¶
dnnl_status_t DNNL_API dnnl_convolution_forward_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_prop_kind_t prop_kind, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t src_desc, const_dnnl_memory_desc_t weights_desc, const_dnnl_memory_desc_t bias_desc, const_dnnl_memory_desc_t dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_attr_t attr )
Creates a primitive descriptor for a convolution forward propagation primitive.
Note
Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.
Arrays strides
, dilates
, padding_l
, and padding_r
contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.
Parameters:
primitive_desc |
Output primitive descriptor. |
engine |
Engine to use. |
prop_kind |
Propagation kind. Possible values are dnnl_forward_training and dnnl_forward_inference. |
alg_kind |
Convolution algorithm. Possible values are dnnl_convolution_direct, dnnl_convolution_winograd, dnnl_convolution_auto. |
src_desc |
Source memory descriptor. |
weights_desc |
Weights memory descriptor. |
bias_desc |
Bias memory descriptor. Passing NULL, a zero memory descriptor, or a memory descriptor with format_kind set to dnnl_format_kind_undef disables the bias term. |
dst_desc |
Destination memory descriptor. |
strides |
Array of strides for spatial dimension. |
dilates |
Array of dilations for spatial dimension. A zero value means no dilation in the corresponding dimension. |
padding_l |
Array of padding values for low indices for each spatial dimension |
padding_r |
Array of padding values for high indices for each spatial dimension |
attr |
Primitive attributes (can be NULL). |
Returns:
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_convolution_backward_data_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t diff_src_desc, const_dnnl_memory_desc_t weights_desc, const_dnnl_memory_desc_t diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_desc_t hint_fwd_pd, const_dnnl_primitive_attr_t attr )
Creates a primitive descriptor for a convolution backward propagation primitive.
Note
Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.
Arrays strides
, dilates
, padding_l
, and padding_r
contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.
Parameters:
primitive_desc |
Output primitive descriptor. |
engine |
Engine to use. |
alg_kind |
Convolution algorithm. Possible values are dnnl_convolution_direct, dnnl_convolution_winograd, dnnl_convolution_auto. |
diff_src_desc |
Diff source memory descriptor. |
weights_desc |
Weights memory descriptor. |
diff_dst_desc |
Diff destination memory descriptor. |
strides |
Array of strides for spatial dimension. |
dilates |
Array of dilations for spatial dimension. A zero value means no dilation in the corresponding dimension. |
padding_l |
Array of padding values for low indices for each spatial dimension |
padding_r |
Array of padding values for high indices for each spatial dimension |
hint_fwd_pd |
Primitive descriptor for a respective forward propagation primitive. |
attr |
Primitive attributes (can be NULL). |
Returns:
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_convolution_backward_weights_primitive_desc_create( dnnl_primitive_desc_t* primitive_desc, dnnl_engine_t engine, dnnl_alg_kind_t alg_kind, const_dnnl_memory_desc_t src_desc, const_dnnl_memory_desc_t diff_weights_desc, const_dnnl_memory_desc_t diff_bias_desc, const_dnnl_memory_desc_t diff_dst_desc, const dnnl_dims_t strides, const dnnl_dims_t dilates, const dnnl_dims_t padding_l, const dnnl_dims_t padding_r, const_dnnl_primitive_desc_t hint_fwd_pd, const_dnnl_primitive_attr_t attr )
Creates a primitive descriptor for a convolution weights gradient primitive.
Note
Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.
Arrays strides
, dilates
, padding_l
, and padding_r
contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.
Parameters:
primitive_desc |
Output primitive descriptor. |
engine |
Engine to use. |
alg_kind |
Convolution algorithm. Possible values are dnnl_convolution_direct, dnnl_convolution_winograd, dnnl_convolution_auto. |
src_desc |
Source memory descriptor. |
diff_weights_desc |
Diff weights memory descriptor. |
diff_bias_desc |
Diff bias memory descriptor. Passing NULL, a zero memory descriptor, or a memory descriptor with format_kind set to dnnl_format_kind_undef disables the bias term. |
diff_dst_desc |
Diff destination memory descriptor. |
strides |
Array of strides for spatial dimension. |
dilates |
Array of dilations for spatial dimension. A zero value means no dilation in the corresponding dimension. |
padding_l |
Array of padding values for low indices for each spatial dimension |
padding_r |
Array of padding values for high indices for each spatial dimension |
hint_fwd_pd |
Primitive descriptor for a respective forward propagation primitive. |
attr |
Primitive attributes (can be NULL). |
Returns:
dnnl_success on success and a status describing the error otherwise.