A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
Convolutions
ArrayFire Functions by Category » Machine Learning

Forward and backward convolution passes More...

## Functions
AFAPI array | convolve2GradientNN (const array &incoming_gradient, const array &original_signal, const array &original_filter, const array &convolved_output, const dim4 stride, const dim4 padding, const dim4 dilation, convGradientType grad_type)
| C++ interface for calculating backward pass gradient of 2D convolution This function calculates the gradient with respect to the output of the convolve2NN function that uses the machine learning formulation for the dimensions of the signals and filters.
AFAPI af_err | af_convolve2_gradient_nn (af_array *out, const af_array incoming_gradient, const af_array original_signal, const af_array original_filter, const af_array convolved_output, const unsigned stride_dims, const dim_t *strides, const unsigned padding_dims, const dim_t *paddings, const unsigned dilation_dims, const dim_t *dilations, af_conv_gradient_type grad_type)
| C interface for calculating backward pass gradient of 2D convolution This function calculates the gradient with respect to the output of the af::convolve2NN() function that uses the machine learning formulation for the dimensions of the signals and filters.

## Detailed Description

Forward and backward convolution passes

## Function Documentation

## ◆ af_convolve2_gradient_nn()

AFAPI af_err af_convolve2_gradient_nn | ( | af_array * | out,
|  | const af_array | incoming_gradient,
|  | const af_array | original_signal,
|  | const af_array | original_filter,
|  | const af_array | convolved_output,
|  | const unsigned | stride_dims,
|  | const dim_t * | strides,
|  | const unsigned | padding_dims,
|  | const dim_t * | paddings,
|  | const unsigned | dilation_dims,
|  | const dim_t * | dilations,
|  | af_conv_gradient_type | grad_type )

C interface for calculating backward pass gradient of 2D convolution This function calculates the gradient with respect to the output of the af::convolve2NN() function that uses the machine learning formulation for the dimensions of the signals and filters.

Parameters

  [out] | out | gradient wrt/gradType
  [in] | incoming_gradient | gradients to be distributed in backwards pass
  [in] | original_signal | input signal to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
  [in] | original_filter | input filter to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
  [in] | convolved_output | output from forward pass of convolution
  [in] | stride_dims | specifies number of stride dimensions
  [in] | strides | array of stride values
  [in] | padding_dims | number of padding dimensions
  [in] | paddings | array of padding values
  [in] | dilation_dims | number of dilation dimensions
  [in] | dilations | array of dilation values
  [in] | grad_type | specifies which gradient to return

Returns
  AF_SUCCESS if the execution completes properly

## ◆ convolve2GradientNN()

AFAPI array convolve2GradientNN | ( | const array & | incoming_gradient,
|  | const array & | original_signal,
|  | const array & | original_filter,
|  | const array & | convolved_output,
|  | const dim4 | stride,
|  | const dim4 | padding,
|  | const dim4 | dilation,
|  | convGradientType | grad_type )

C++ interface for calculating backward pass gradient of 2D convolution This function calculates the gradient with respect to the output of the convolve2NN function that uses the machine learning formulation for the dimensions of the signals and filters.

Parameters

  [in] | incoming_gradient | gradients to be distributed in backwards pass
  [in] | original_signal | input signal to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
  [in] | original_filter | input filter to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
  [in] | convolved_output | output from forward pass of convolution
  [in] | stride | specifies strides along each dimension for original convolution
  [in] | padding | specifies padding width along each dimension for original convolution
  [in] | dilation | specifies filter dilation along each dimension for original convolution
  [in] | grad_type | specifies which gradient to return

Returns
  gradient wrt/grad_type

Note
  Make sure you pass in both dim0, and dim1 in your dim4 arguments. The third and fourth dimensions are currently ignored.