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 22
33Consider some function
44$$ 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.
66$$ \frac{\partial f}{\partial x} = \frac{\partial g}{\partial x} + \frac{\partial h}{\partial x} $$ .
77In general, we must accumulate (sum) gradients from each sub-part of a program where a variable is used.
88
@@ -55,7 +55,8 @@ Let's illustrate it with our example.
5555
5656``` julia
5757b̄ = 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+ ```
5960` b̄ ` is a matrix entirely of zeros, except for at the index ` 2 ` , where it is set to the output sensitivity ` ȳ ` .
6061` ā ` is similar, except with the non-zero at index ` 1 ` .
6162
You can’t perform that action at this time.
0 commit comments