A high-performance general-purpose compute library

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. More...
 
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. More...
 

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]outgradient wrt/gradType
[in]incoming_gradientgradients to be distributed in backwards pass
[in]original_signalinput signal to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
[in]original_filterinput filter to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
[in]convolved_outputoutput from forward pass of convolution
[in]stride_dimsspecifies number of stride dimensions
[in]stridesarray of stride values
[in]padding_dimsnumber of padding dimensions
[in]paddingsarray of padding values
[in]dilation_dimsnumber of dilation dimensions
[in]dilationsarray of dilation values
[in]grad_typespecifies 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_gradientgradients to be distributed in backwards pass
[in]original_signalinput signal to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
[in]original_filterinput filter to forward pass of convolution assumed structure of input is ( d0 x d1 x d2 x N )
[in]convolved_outputoutput from forward pass of convolution
[in]stridespecifies strides along each dimension for original convolution
[in]paddingspecifies padding width along each dimension for original convolution
[in]dilationspecifies filter dilation along each dimension for original convolution
[in]grad_typespecifies 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.