Convolutional Layer

Contents

Convolutional Layer#

The convolution layer API documentation

miopenConvolutionMode_t#

enum miopenConvolutionMode_t#

Convolution mode selection for convolution layer preference.

Values:

enumerator miopenConvolution#

Cross-Correlation convolution

enumerator miopenTranspose#

Transpose convolutions — deconvolution

enumerator miopenGroupConv#

Deprecated Group convolution legacy, ToBe Removed

enumerator miopenDepthwise#

Deprecated Depthwise convolution legacy, ToBe Removed

miopenConvFwdAlgorithm_t#

enum miopenConvFwdAlgorithm_t#

Convolutional algorithm mode for forward propagation. MIOpen use cross-correlation for its convolution implementation.

Values:

enumerator miopenConvolutionFwdAlgoGEMM#

GEMM variant

enumerator miopenConvolutionFwdAlgoDirect#

Direct convolutions

enumerator miopenConvolutionFwdAlgoFFT#

Fast Fourier Transform indirect convolutions

enumerator miopenConvolutionFwdAlgoWinograd#

Winograd indirect convolutions

enumerator miopenConvolutionFwdAlgoImplicitGEMM#

Implicit GEMM convolutions

miopenConvBwdWeightsAlgorithm_t#

enum miopenConvBwdWeightsAlgorithm_t#

Convolutional algorithm mode for back propagation on weights.

Values:

enumerator miopenConvolutionBwdWeightsAlgoGEMM#

GEMM variant

enumerator miopenConvolutionBwdWeightsAlgoDirect#

Direct convolution algorithm

enumerator miopenConvolutionBwdWeightsAlgoWinograd#

Winograd convolutions

enumerator miopenConvolutionBwdWeightsAlgoImplicitGEMM#

Implicit GEMM convolutions

miopenConvBwdDataAlgorithm_t#

enum miopenConvBwdDataAlgorithm_t#

Convolutional algorithm mode for back propagation on data.

Values:

enumerator miopenConvolutionBwdDataAlgoGEMM#

GEMM variant

enumerator miopenConvolutionBwdDataAlgoDirect#

Direct convolutions

enumerator miopenConvolutionBwdDataAlgoFFT#

Fast Fourier Transform indirect convolutions

enumerator miopenConvolutionBwdDataAlgoWinograd#

Winograd indirect convolutions

enumerator miopenTransposeBwdDataAlgoGEMM#

Deprecated Transpose GEMM variant legacy, ToBe Removed

enumerator miopenConvolutionBwdDataAlgoImplicitGEMM#

Implicit GEMM convolutions

miopenConvAlgoPerf_t#

struct miopenConvAlgoPerf_t#

Perf struct for forward, backward filter, or backward data algorithms.

Contains the union to hold the selected convolution algorithm for forward, or backwards layers, and also contains the time it took to run the algorithm and the workspace required to run the algorithm. The workspace in this structure can be used when executing the convolution layer.

miopenConvSolution_t#

struct miopenConvSolution_t#

Performance struct for forward, backward filter, or backward data algorithms in immediate mode.

Contains a 64-bit integer identifying the solution and the algorithm for the solution, as well as the runtime, workspace size and a boolean flag indicating whether the returned solution is a heuristic or resulting from an actual run

miopenCreateConvolutionDescriptor#

miopenStatus_t miopenCreateConvolutionDescriptor(miopenConvolutionDescriptor_t *convDesc)#

Creates a convolution layer descriptor.

Parameters:

convDesc – Convolution layer descriptor

Returns:

miopenStatus_t

miopenInitConvolutionDescriptor#

miopenStatus_t miopenInitConvolutionDescriptor(miopenConvolutionDescriptor_t convDesc, miopenConvolutionMode_t c_mode, int pad_h, int pad_w, int stride_h, int stride_w, int dilation_h, int dilation_w)#

Creates a 2-D convolution layer descriptor.

For group/depthwise convolution dilation height and width, only a dilation value of 1 is supported.

Parameters:
  • convDesc – Convolution layer descriptor (output)

  • c_mode – Convolutional mode (input)

  • pad_h – Height input data padding (input)

  • pad_w – Width input data padding (input)

  • stride_h – Stride for the height of input data (input)

  • stride_w – Stride for the width of input data (input)

  • dilation_h – Dilation height (input)

  • dilation_w – Dilation width (input)

Returns:

miopenStatus_t

miopenInitConvolutionNdDescriptor#

miopenStatus_t miopenInitConvolutionNdDescriptor(miopenConvolutionDescriptor_t convDesc, int spatialDim, int *padA, int *strideA, int *dilationA, miopenConvolutionMode_t c_mode)#

Creates a N-dimensional convolution layer descriptor.

Parameters:
  • convDesc – Convolution layer descriptor (output)

  • spatialDim – Convolutional spatial dimension (input)

  • padA – Array of input data padding (input)

  • strideA – Array of convolution stride (input)

  • dilationA – Array of convolution dilation (input)

  • c_mode – Convolutional mode (input)

Returns:

miopenStatus_t

miopenGetConvolutionDescriptor#

miopenStatus_t miopenGetConvolutionDescriptor(miopenConvolutionDescriptor_t convDesc, miopenConvolutionMode_t *c_mode, int *pad_h, int *pad_w, int *stride_h, int *stride_w, int *dilation_h, int *dilation_w)#

Retrieves a 2-D convolution layer descriptor’s details.

For group/depthwise convolution dilation height and width, only a dilation value of 1 is supported.

Parameters:
  • convDesc – Convolution layer descriptor (input)

  • c_mode – Convolutional mode (output)

  • pad_h – Height input data padding (output)

  • pad_w – Width input data padding (output)

  • stride_h – Stride for the height of input data (output)

  • stride_w – Stride for the width of input data (output)

  • dilation_h – Dilation height (output)

  • dilation_w – Dilation width (output)

Returns:

miopenStatus_t

miopenGetConvolutionNdDescriptor#

miopenStatus_t miopenGetConvolutionNdDescriptor(miopenConvolutionDescriptor_t convDesc, int requestedSpatialDim, int *spatialDim, int *padA, int *strideA, int *dilationA, miopenConvolutionMode_t *c_mode)#

Retrieves a N-dimensional convolution layer descriptor’s details.

Parameters:
  • convDesc – Convolution layer descriptor (input)

  • requestedSpatialDim – Expected convolution spatial dimension (intput)

  • spatialDim – Convolutional spatial dimension (output)

  • padA – Array of input data padding (output)

  • strideA – Array of convolution stride (output)

  • dilationA – Array of convolution dilation (output)

  • c_mode – Convolutional mode (output)

Returns:

miopenStatus_t

miopenSetConvolutionGroupCount#

miopenStatus_t miopenSetConvolutionGroupCount(miopenConvolutionDescriptor_t convDesc, int groupCount)#

Set the number of groups to be used in Group/Depthwise convolution.

Must be called before all computational APIs of group/depthwise convolution, it is preferable to call miopenInitConvolutionDescriptor() first, then miopenSetConvolutionGroupCount() to fully initialize group convolutions. Both Convolution Mode and Transpose Convolution Mode support group/depthwise convolution. To run depthwise convolution, set groupCount value equal to number of channels.

Parameters:
  • convDesc – Convolution layer descriptor (output)

  • groupCount – number of groups, in depthwise conv using filter_number/channel_multiplier (input)

Returns:

miopenStatus_t

miopenSetTransposeConvOutputPadding#

miopenStatus_t miopenSetTransposeConvOutputPadding(miopenConvolutionDescriptor_t convDesc, int adj_h, int adj_w)#

Set the output padding to be used in 2-D Transpose convolution.

This function is optional for initialization of Transpose convolution. If applicable, it must be called before all computational APIs of Transpose convolution. It is preferable to call miopenInitConvolutionDescriptor() first, then miopenSetTransposeConvOutputPadding() to fully initialize transpose convolutions.

Parameters:
  • convDesc – Convolution layer descriptor (output)

  • adj_h – output padding for the height of output data (input)

  • adj_w – output padding for the width of output data (input)

Returns:

miopenStatus_t

miopenSetTransposeConvNdOutputPadding#

miopenStatus_t miopenSetTransposeConvNdOutputPadding(miopenConvolutionDescriptor_t convDesc, int spatialDim, int *adjA)#

Set the output padding to be used in N-dimensional Transpose convolution.

This function is optional for initialization of Transpose convolution. If applicable, it must be called before all computational APIs of Transpose convolution. It is preferable to call miopenInitConvolutionNdDescriptor() first, then miopenSetTransposeConvNdOutputPadding() to fully initialize transpose convolutions. Currently, 2-D and 3-D convolutions are supported.

Parameters:
  • convDesc – Convolution layer descriptor (output)

  • spatialDim – Convolutional spatial dimension (input)

  • adjA – array of output padding for output data (input)

Returns:

miopenStatus_t

miopenGetConvolutionForwardOutputDim#

miopenStatus_t miopenGetConvolutionForwardOutputDim(miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t inputTensorDesc, const miopenTensorDescriptor_t filterDesc, int *n, int *c, int *h, int *w)#

Get the shape of a resulting 4-D tensor from a 2-D convolution.

This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allocate the proper amount of memory prior to launch the actual convolution.

Parameters:
  • convDesc – Convolution layer descriptor (input)

  • inputTensorDesc – Input data tensor descriptor (input)

  • filterDesc – Weight descriptor (input)

  • n – Mini-batch size (output)

  • c – Number of channels (output)

  • h – Data height dimension size (output)

  • w – Data width dimension size (output)

Returns:

miopenStatus_t

miopenGetConvolutionNdForwardOutputDim#

miopenStatus_t miopenGetConvolutionNdForwardOutputDim(miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t inputTensorDesc, const miopenTensorDescriptor_t filterDesc, int *nDim, int *outputTensorDimA)#

Get the shape of a resulting N-dimensional tensor from a (N-2)-dimensional convolution.

This function returns the dimensions of the resulting N-dimensional tensor of a (N-2)-dimensional convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. It is used to setup the output tensor descriptor prior to executing the convolution layer.

Parameters:
  • convDesc – Convolution layer descriptor (input)

  • inputTensorDesc – Input data tensor descriptor (input)

  • filterDesc – Weight descriptor (input)

  • nDim – Pointer to Output data tensor dimension (output)

  • outputTensorDimA – Array of Output data tensor length (output)

miopenConvolutionForwardGetWorkSpaceSize#

miopenStatus_t miopenConvolutionForwardGetWorkSpaceSize(miopenHandle_t handle, const miopenTensorDescriptor_t wDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, size_t *workSpaceSize)#

Query the workspace size required for a forward convolution layer.

This call is required and must be executed once before running miopenFindConvolutionForwardAlgorithm() in order to determine the largest required allocation for the algorithm search; i.e., the maximum size of the memory needed from the set of potential forward convolution algorithm is returned.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • xDesc – Tensor descriptor for input data tensor x (input)

  • convDesc – Convolution layer descriptor (input)

  • yDesc – Tensor descriptor for output data tensor y (input)

  • workSpaceSize – Pointer to memory to return size in bytes (output)

Returns:

miopenStatus_t

miopenFindConvolutionForwardAlgorithm#

miopenStatus_t miopenFindConvolutionForwardAlgorithm(miopenHandle_t handle, const miopenTensorDescriptor_t xDesc, const void *x, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t yDesc, void *y, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch)#

Search and run the forward convolutional algorithms and return a list of kernel times.

This function attempts all MIOpen forward convolution algorithms based on the input configuration, and outputs performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in a sorted fashion where the first element has the lowest compute time. Users can chose the top-most algorithm if they only care about the fastest algorithm.

This function is mandatory before using miopenConvolutionForward(). In order to execute this function, miopenConvolutionForwardGetWorkSpaceSize() must be run to determine the required memory for this search.

  • If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.

  • If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • xDesc – Tensor descriptor for data input tensor x (input)

  • x – Data tensor x (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • w – Weights tensor w (input)

  • convDesc – Convolution layer descriptor (input)

  • yDesc – Tensor descriptor for output data tensor y (input)

  • y – Data tensor y (output)

  • requestAlgoCount – Number of algorithms to return kernel times (input)

  • returnedAlgoCount – Pointer to number of algorithms returned (output)

  • perfResults – Pointer to union of best algorithm for forward and backwards (input)

  • workSpace – Pointer to workspace required for the search (output)

  • workSpaceSize – Size in bytes of the memory needed for find (output)

  • exhaustiveSearch – A boolean to toggle a full search of all algorithms and configurations (input)

Returns:

miopenStatus_t

miopenConvolutionForward#

miopenStatus_t miopenConvolutionForward(miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t xDesc, const void *x, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, miopenConvFwdAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t yDesc, void *y, void *workSpace, size_t workSpaceSize)#

Execute a forward convolution layer.

Runs the forward convolution layer based on the selected algorithm. The function miopenFindConvolutionForwardAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • xDesc – Tensor descriptor for data input tensor x (input)

  • x – Data tensor x (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • w – Weights tensor w (inputs)

  • convDesc – Convolution layer descriptor (inputs)

  • algo – Algorithm selected (inputs)

  • beta – Floating point shift factor, allocated on the host (input)

  • yDesc – Tensor descriptor for output data tensor y (input)

  • y – Data tensor y (output)

  • workSpace – Pointer to workspace required (input)

  • workSpaceSize – Size in bytes of the memory determined by the find step (input)

Returns:

miopenStatus_t

miopenConvolutionForwardBias#

miopenStatus_t miopenConvolutionForwardBias(miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t bDesc, const void *b, const void *beta, const miopenTensorDescriptor_t yDesc, void *y)#

Calculate element-wise scale and shift of a tensor via a bias tensor.

This function applies an element-wise bias to a data tensor from an input bias tensor.

Parameters:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • bDesc – Tensor descriptor for bias tensor b (input)

  • b – Bias tensor b (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • yDesc – Tensor descriptor for data tensor y (input)

  • y – Data tensor y (input and output)

Returns:

miopenStatus_t

miopenFindConvolutionBackwardDataAlgorithm#

miopenStatus_t miopenFindConvolutionBackwardDataAlgorithm(miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, void *dx, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch)#

Search and run the backwards data convolution algorithms and return a list of kernel times.

This function attempts all MIOpen backward data convolution algorithms, and outputs the performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in sorted fashion where the first element has the lowest compute time. This function is mandatory before using backwards convolutions. Users can chose the top-most algorithm if they only care about the fastest algorithm.

This function is mandatory before using miopenConvolutionBackwardData(). In order to execute this function, miopenConvolutionBackwardsDataGetWorkSpaceSize() must be run to determine the required memory for this search.

  • If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.

  • If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • dy – Data delta tensor dy (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • w – Weights tensor w (input)

  • convDesc – Convolution layer descriptor (input)

  • dxDesc – Tensor descriptor for output data tensor dx (input)

  • dx – Data delta tensor dx (input)

  • requestAlgoCount – Number of algorithms to return kernel times (input)

  • returnedAlgoCount – Pointer to number of algorithms returned (output)

  • perfResults – Pointer to union of best algorithm for forward and backwards (output)

  • workSpace – Pointer to workspace required for the search (output)

  • workSpaceSize – Size in bytes of the memory needed for find (output)

  • exhaustiveSearch – A boolean to toggle a full search of all algorithms and configurations (input)

Returns:

miopenStatus_t

miopenConvolutionBackwardData#

miopenStatus_t miopenConvolutionBackwardData(miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t wDesc, const void *w, const miopenConvolutionDescriptor_t convDesc, miopenConvBwdDataAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t dxDesc, void *dx, void *workSpace, size_t workSpaceSize)#

Execute a backward data convolution layer.

Runs the backward data convolution layer based on the selected algorithm. The function miopenFindConvolutionBackwardDataAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • dy – Data delta tensor dy (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • w – Weights tensor w (input)

  • convDesc – Convolution layer descriptor (input)

  • algo – Algorithm selected (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • dxDesc – Tensor descriptor for output data tensor dx (input)

  • dx – Data delta tensor dx (output)

  • workSpace – Pointer to workspace required for the search (input)

  • workSpaceSize – Size in bytes of the memory needed for find (input)

Returns:

miopenStatus_t

miopenConvolutionBackwardDataGetWorkSpaceSize#

miopenStatus_t miopenConvolutionBackwardDataGetWorkSpaceSize(miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t wDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dxDesc, size_t *workSpaceSize)#

Get the GPU memory required for the backward data convolution algorithm.

For a provided tensor descriptors and algorithm selection, this function calculates and returns the workspace size required for back propagation on data. This call is required and must be executed once before running miopenFindConvolutionBackwardDataAlgorithm() in order to determine the largest required allocation for the algorithm search; i.e., the maximum size of the memory needed from the set of potential backward convolution algorithm is returned.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • wDesc – Tensor descriptor for weight tensor w (input)

  • convDesc – Convolution layer descriptor (input)

  • dxDesc – Tensor descriptor for output data tensor dx (input)

  • workSpaceSize – Size in bytes of the memory required (output)

Returns:

miopenStatus_t

miopenConvolutionBackwardWeightsGetWorkSpaceSize#

miopenStatus_t miopenConvolutionBackwardWeightsGetWorkSpaceSize(miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const miopenTensorDescriptor_t xDesc, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, size_t *workSpaceSize)#

Get the GPU memory required for the backward weights convolution algorithm.

For a provided tensor descriptors and algorithm selection, this function calculates and returns the workspace size required for back propagation on data. This call is required and must be executed once before running miopenFindConvolutionBackwardWeightsAlgorithm() in order to determine the largest required allocation for the algorithm search; i.e., the maximum size of the memory needed from the set of potential backward weights convolution algorithm is returned.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • xDesc – Tensor descriptor for data tensor x (input)

  • convDesc – Convolution layer descriptor (input)

  • dwDesc – Tensor descriptor for output weights tensor dw (input)

  • workSpaceSize – Size in bytes of the memory required (output)

Returns:

miopenStatus_t

miopenFindConvolutionBackwardWeightsAlgorithm#

miopenStatus_t miopenFindConvolutionBackwardWeightsAlgorithm(miopenHandle_t handle, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, const miopenTensorDescriptor_t dwDesc, void *dw, const int requestAlgoCount, int *returnedAlgoCount, miopenConvAlgoPerf_t *perfResults, void *workSpace, size_t workSpaceSize, bool exhaustiveSearch)#

Search and run the backwards weights convolutional algorithms and return a list of kernel times.

This function attempts all MIOpen backward weights convolution algorithms, and outputs the performance metrics to a user-allocated array of type miopenConvAlgoPerf_t. These metrics are written in sorted fashion where the first element has the lowest compute time. This function is mandatory before using backwards weight convolutions. Users can chose the top-most algorithm if they only care about the fastest algorithm.

This function is mandatory before using miopenConvolutionBackwardWeights(). In order to execute this function, miopenConvolutionBackwardsWeightsGetWorkSpaceSize() must be run to determine the required memory for this search.

  • If exhaustiveSearch == 0, MIOpen will look for the first kernel with a configuration match. If a configuration match is not found, a default configuration will be returned.

  • If exhaustiveSearch == 1, MIOpen will look for the best kernel for the provided configuration. If a match is not found, an exhaustive search is performed by running individual algorithms.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • dy – Data delta tensor dy (input)

  • xDesc – Tensor descriptor for output data tensor x (input)

  • x – Data delta tensor dx (input)

  • convDesc – Convolution layer descriptor (input)

  • dwDesc – Tensor descriptor for weight tensor dw (input)

  • dw – Weights delta tensor dw (input)

  • requestAlgoCount – Number of algorithms to return kernel times (input)

  • returnedAlgoCount – Pointer to number of algorithms returned (output)

  • perfResults – Pointer to union of best algorithm for forward and backwards (output)

  • workSpace – Pointer to workspace required for the search (output)

  • workSpaceSize – Size in bytes of the memory needed for find (output)

  • exhaustiveSearch – A boolean to toggle a full search of all algorithms and configurations (input)

Returns:

miopenStatus_t

miopenConvolutionBackwardWeights#

miopenStatus_t miopenConvolutionBackwardWeights(miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const miopenTensorDescriptor_t xDesc, const void *x, const miopenConvolutionDescriptor_t convDesc, miopenConvBwdWeightsAlgorithm_t algo, const void *beta, const miopenTensorDescriptor_t dwDesc, void *dw, void *workSpace, size_t workSpaceSize)#

Execute a backward weights convolution layer.

Runs the backward weights convolution layer based on the selected algorithm. The function miopenFindConvolutionBackwardWeightsAlgorithm() must have been executed previously to determine the required memory needed for the workspace and the best convolutional algorithm.

If using Group/Depthwise convolution mode, call miopenSetConvolutionGroupCount() before running this.

Parameters:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • dyDesc – Tensor descriptor for data tensor dy (input)

  • dy – Data delta tensor dy (input)

  • xDesc – Tensor descriptor for data tensor x (input)

  • x – Data tensor x (input)

  • convDesc – Convolution layer descriptor (input)

  • algo – Algorithm selected (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • dwDesc – Tensor descriptor for weight tensor dw (input)

  • dw – Weights delta tensor dw (output)

  • workSpace – Pointer to workspace required for the search (input)

  • workSpaceSize – Size in bytes of the memory needed for find (input)

Returns:

miopenStatus_t

miopenConvolutionBackwardBias#

miopenStatus_t miopenConvolutionBackwardBias(miopenHandle_t handle, const void *alpha, const miopenTensorDescriptor_t dyDesc, const void *dy, const void *beta, const miopenTensorDescriptor_t dbDesc, void *db)#

Calculates the gradient with respect to the bias.

Compute the convolution backwards gradient with respect to the bias tensor.

Parameters:
  • handle – MIOpen handle (input)

  • alpha – Floating point scaling factor, allocated on the host (input)

  • dyDesc – Tensor descriptor for data input tensor dy (input)

  • dy – Data delta tensor dy (input)

  • beta – Floating point shift factor, allocated on the host (input)

  • dbDesc – Tensor descriptor for input bias tensor db (input)

  • db – Bias delta tensor db (output)

Returns:

miopenStatus_t

miopenDestroyConvolutionDescriptor#

miopenStatus_t miopenDestroyConvolutionDescriptor(miopenConvolutionDescriptor_t convDesc)#

Destroys the tensor descriptor object.

Parameters:

convDesc – Convolution tensor descriptor type (input)

Returns:

miopenStatus_t