-
Notifications
You must be signed in to change notification settings - Fork 555
Expand file tree
/
Copy pathml.h
More file actions
98 lines (84 loc) · 4.31 KB
/
Copy pathml.h
File metadata and controls
98 lines (84 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*******************************************************
* Copyright (c) 2018, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <af/defines.h>
#ifdef __cplusplus
namespace af
{
class array;
class dim4;
#if AF_API_VERSION >= 37
/**
C++ interface for calculating backward pass gradient of 2D convolution
This function calculates the gradient with respect to the output
of the \ref convolve2NN function that uses the machine learning
formulation for the dimensions of the signals and filters
\param[in] incoming_gradient gradients to be distributed in backwards pass
\param[in] original_signal input signal to forward pass of convolution
assumed structure of input is ( d0 x d1 x d2 x N )
\param[in] original_filter input filter to forward pass of convolution
assumed structure of input is ( d0 x d1 x d2 x N )
\param[in] convolved_output output from forward pass of convolution
\param[in] stride specifies strides along each dimension for original convolution
\param[in] padding specifies padding width along each dimension for original convolution
\param[in] dilation specifies filter dilation along each dimension for original convolution
\param[in] grad_type specifies which gradient to return
\return 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.
\ingroup ml_convolution
*/
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);
#endif
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if AF_API_VERSION >= 37
/**
C interface for calculating backward pass gradient of 2D convolution
This function calculates the gradient with respect to the output
of the \ref af::convolve2NN() function that uses the machine learning
formulation for the dimensions of the signals and filters
\param[out] out gradient wrt/gradType
\param[in] incoming_gradient gradients to be distributed in backwards pass
\param[in] original_signal input signal to forward pass of convolution
assumed structure of input is ( d0 x d1 x d2 x N )
\param[in] original_filter input filter to forward pass of convolution
assumed structure of input is ( d0 x d1 x d2 x N )
\param[in] convolved_output output from forward pass of convolution
\param[in] stride_dims specifies number of stride dimensions
\param[in] strides array of stride values
\param[in] padding_dims number of padding dimensions
\param[in] paddings array of padding values
\param[in] dilation_dims number of dilation dimensions
\param[in] dilations array of dilation values
\param[in] grad_type specifies which gradient to return
\return \ref AF_SUCCESS if the execution completes properly
\ingroup ml_convolution
*/
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);
#endif
#ifdef __cplusplus
}
#endif