.. index:: pair: group; Convolution .. _doxid-group__dnnl__api__convolution: Convolution =========== .. toctree:: :hidden: struct_dnnl_convolution_backward_data.rst struct_dnnl_convolution_backward_weights.rst struct_dnnl_convolution_forward.rst struct_dnnl_convolution_desc_t.rst Overview ~~~~~~~~ A primitive to perform 1D, 2D or 3D convolution. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block // structs struct :ref:`dnnl::convolution_backward_data`; struct :ref:`dnnl::convolution_backward_weights`; struct :ref:`dnnl::convolution_forward`; struct :ref:`dnnl_convolution_desc_t`; // global functions :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_convolution_forward_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_prop_kind_t` prop_kind, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* bias_desc, const :ref:`dnnl_memory_desc_t`* dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_dilated_convolution_forward_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_prop_kind_t` prop_kind, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* bias_desc, const :ref:`dnnl_memory_desc_t`* dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_convolution_backward_data_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* diff_src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_dilated_convolution_backward_data_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* diff_src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_convolution_backward_weights_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* diff_weights_desc, const :ref:`dnnl_memory_desc_t`* diff_bias_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); :ref:`dnnl_status_t` DNNL_API :ref:`dnnl_dilated_convolution_backward_weights_desc_init`( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* diff_weights_desc, const :ref:`dnnl_memory_desc_t`* diff_bias_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ); .. _details-group__dnnl__api__convolution: 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. .. rubric:: See also: :ref:`Convolution ` in developer guide Global Functions ---------------- .. index:: pair: function; dnnl_convolution_forward_desc_init .. _doxid-group__dnnl__api__convolution_1ga9699a81a0e3341014447e4da0cdd7e18: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_convolution_forward_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_prop_kind_t` prop_kind, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* bias_desc, const :ref:`dnnl_memory_desc_t`* dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a convolution forward propagation primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`dnnl_format_kind_any `. Arrays ``strides``, ``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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - prop_kind - Propagation kind. Possible values are :ref:`dnnl_forward_training ` and :ref:`dnnl_forward_inference `. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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 :ref:`dnnl_format_kind_undef ` disables the bias term. * - dst_desc - Destination memory descriptor. * - strides - Array of strides for spatial dimension. * - padding_l - Array of padding values for low indices for each spatial dimension ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is assumed to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise. .. index:: pair: function; dnnl_dilated_convolution_forward_desc_init .. _doxid-group__dnnl__api__convolution_1gab5b19353f9dfc944e1f6dc8aa1bb857d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_dilated_convolution_forward_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_prop_kind_t` prop_kind, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* bias_desc, const :ref:`dnnl_memory_desc_t`* dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a dilated convolution forward propagation primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - prop_kind - Propagation kind. Possible values are :ref:`dnnl_forward_training ` and :ref:`dnnl_forward_inference `. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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 :ref:`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 ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is considered to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise. .. index:: pair: function; dnnl_convolution_backward_data_desc_init .. _doxid-group__dnnl__api__convolution_1gadb8819372f8855f2352e153cdeb0e2d6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_convolution_backward_data_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* diff_src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a convolution backward propagation primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`dnnl_format_kind_any `. Arrays ``strides``, ``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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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. * - padding_l - Array of padding values for low indices for each spatial dimension ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is assumed to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise. .. index:: pair: function; dnnl_dilated_convolution_backward_data_desc_init .. _doxid-group__dnnl__api__convolution_1gad3c2e2e18162df7420cdfec6a4369339: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_dilated_convolution_backward_data_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* diff_src_desc, const :ref:`dnnl_memory_desc_t`* weights_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a dilated convolution backward propagation primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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 ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is considered to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise. .. index:: pair: function; dnnl_convolution_backward_weights_desc_init .. _doxid-group__dnnl__api__convolution_1gac316460f4b2bfc654bd46504838b616c: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_convolution_backward_weights_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* diff_weights_desc, const :ref:`dnnl_memory_desc_t`* diff_bias_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a convolution weights gradient primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`dnnl_format_kind_any `. Arrays ``strides``, ``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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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 :ref:`dnnl_format_kind_undef ` disables the bias term. * - diff_dst_desc - Diff destination memory descriptor. * - strides - Array of strides for spatial dimension. * - padding_l - Array of padding values for low indices for each spatial dimension ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is considered to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise. .. index:: pair: function; dnnl_dilated_convolution_backward_weights_desc_init .. _doxid-group__dnnl__api__convolution_1gaa057c055239d6f33795f4e6bde95ec7b: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`dnnl_status_t` DNNL_API dnnl_dilated_convolution_backward_weights_desc_init( :ref:`dnnl_convolution_desc_t`* conv_desc, :ref:`dnnl_alg_kind_t` alg_kind, const :ref:`dnnl_memory_desc_t`* src_desc, const :ref:`dnnl_memory_desc_t`* diff_weights_desc, const :ref:`dnnl_memory_desc_t`* diff_bias_desc, const :ref:`dnnl_memory_desc_t`* diff_dst_desc, const :ref:`dnnl_dims_t` strides, const :ref:`dnnl_dims_t` dilates, const :ref:`dnnl_dims_t` padding_l, const :ref:`dnnl_dims_t` padding_r ) Initializes a descriptor for a dilated convolution weights gradient primitive. .. note:: Memory descriptors can be initialized with :ref:`dnnl_format_tag_any ` or with format_kind set to :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - conv_desc - Output descriptor for a convolution primitive. * - alg_kind - Convolution algorithm. Possible values are :ref:`dnnl_convolution_direct `, :ref:`dnnl_convolution_winograd `, :ref:`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 :ref:`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 ``([[front,] top,] left)``. * - padding_r - Array of padding values for high indices for each spatial dimension ``([[back,] bottom,] right)``. Can be NULL in which case padding is considered to be symmetrical. .. rubric:: Returns: :ref:`dnnl_success ` on success and a status describing the error otherwise.