File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Consider some function
4
4
$$ f(x) = g(x) + h(x) $$ .
5
- If we would like the derivative of $f$ with respect to $x$ we must compute it for each part and then sum them, i.e.
5
+ If we would like the derivative of $f$ with respect to $x$ we must compute it for each part and then sum them, i.e.
6
6
$$ \frac{\partial f}{\partial x} = \frac{\partial g}{\partial x} + \frac{\partial h}{\partial x} $$ .
7
7
In general, we must accumulate (sum) gradients from each sub-part of a program where a variable is used.
8
8
@@ -55,7 +55,8 @@ Let's illustrate it with our example.
55
55
56
56
``` julia
57
57
b̄ = zeros (size (X))
58
- b̄[2 ] = ȳ # the scalar sensitivity of the `mysum` output
58
+ b̄[2 ] = ȳ # the scalar sensitivity of the `sum_first_and_second` output
59
+ ```
59
60
` b̄ ` is a matrix entirely of zeros, except for at the index ` 2 ` , where it is set to the output sensitivity ` ȳ ` .
60
61
` ā ` is similar, except with the non-zero at index ` 1 ` .
61
62
You can’t perform that action at this time.
0 commit comments