Creates propagation operations for convolution layers. Note: The Deep Neural Network (DNN) component in Intel MKL is deprecated and will be removed in a future release. You can continue to use optimized functions for deep neural networks through Intel Math Kernel Library for Deep Neural Networks.

Syntax

dnnError_t dnnConvolutionCreateForward_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateForwardBias_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardData_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardFilter_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardBias_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t dstSize[]);

dnnError_t dnnConvolutionCreateForward_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateForwardBias_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardData_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardFilter_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnConvolutionCreateBackwardBias_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t dimension, const size_t dstSize[]);

dnnError_t dnnGroupsConvolutionCreateForward_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateForwardBias_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardData_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardFilter_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardBias_F32 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[]);

dnnError_t dnnGroupsConvolutionCreateForward_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateForwardBias_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardData_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardFilter_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t srcSize[], const size_t dstSize[], const size_t filterSize[], const size_t convolutionStrides[], const int inputOffset[], const dnnBorder_t borderType);

dnnError_t dnnGroupsConvolutionCreateBackwardBias_F64 (dnnPrimitive_t *pConvolution, dnnPrimitiveAttributes_t attributes, dnnAlgorithm_t algorithm, size_t groups, size_t dimension, const size_t dstSize[]);

Include Files

  • mkl.h

Input Parameters

algorithm

The algorithm to be used by the created propagation operation.

attributes

The set of attributes for the primitive.

groups

The number of groups in the input and output.

dimension

The number of dimensions of the input and output.

srcSize

srcSize[i] is the size of the input along the dimension i.

dstSize

dstSize[i] is the size of the output along the dimension i.

filterSize

filterSize[i] is the size of the filter along the dimension i.

convolutionStrides

Spatial intervals where to apply the filters to the input.

inputOffset

An array of size:

  • dimension - 2 if borderType equals dnnBorderZeros

  • 2*(dimension-2) if borderType equals dnnBorderZerosAsymm

Describes the offset for the spatial domain. Values of inputOffset must be non-positive and specify the spatial offset to add to the indices when applying the filter to the input:

  • If borderType equals dnnBorderZeros, inputOffset[i] specifies equal left and right offsets.

  • If borderType equals dnnBorderZerosAsymm, inputOffset[i] specifies the left (top) offset, while inputOffset[dimension - 2 + i] specifies the right (bottom) offset.

borderType

The method to pad the input when a summation runs out of the input array.

Output Parameters

pConvolution

Pointer to the primitive to create:

dnnConvolutionCreateForward

Forward without bias

dnnConvolutionCreateForwardBias

Forward with bias

dnnConvolutionCreateBackwardData

Backward with respect to data

dnnConvolutionCreateBackwardFilter

Backward with respect to filter

dnnConvolutionCreateBackwardBias

Backward with respect to bias

dnnGroupsConvolutionCreateForward

Forward without bias, with groups

dnnGroupsConvolutionCreateForwardBias

Forward with bias, with groups

dnnGroupsConvolutionCreateBackwardData

Backward with respect to data, with groups

dnnGroupsConvolutionCreateBackwardFilter

Backward with respect to filter, with groups

dnnGroupsConvolutionCreateBackwardBias

Backward with respect to bias, with groups

Description

The dnnConvolutionCreate and dnnGroupsConvolutionCreate functions create forward and backward propagation operations for batch convolutions.

Dimensions from 0 to dimension-3 are spatial dimensions.

The dimension dimension-2 is interpreted as input and output channels.

The dimension dimension-1 is interpreted as elements of the batch.

Let the input and output arrays have plain layout. The channels are divided into groups groups. Assuming g is the index of some group from 0 to groups-1, the output element dst[x][oc][b] is computed as follows:

dst[x][oc][b] =

sum(dx,ic; src[x.convolutionStrides+dx+inputOffset][ic][b]*filter[dx][ic][oc][g])+bias[oc][g],

where the summation is restricted to the input channels in the group g and '.' denotes the element-wise product of two arrays.

If the number of groups is 1, call dnnConvolutionCreate, otherwise, call dnnGroupsConvolutionCreate.

Formulas to calculate the sizes of the output spatial domain depend on the value of borderType as illustrated for the width:

  • If borderType equals dnnBorderZeros,



  • If borderType equals dnnBorderZerosAsymm,



In these formulas:

OW is the output width (dstSize[0])

IW is the input width (srcSize[0])

KW is the filter size for width (filterSize[0])

S is the convolution stride for width (convolutionStrides[0])

有关编译器优化的更完整信息,请参阅优化通知
选择粘滞按钮颜色: 
Orange (only for download buttons)