Skip to content

Commit 0fa97bd

Browse files
Add missing code-block syntax to fix rendering (#294)
1 parent 864901f commit 0fa97bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/src/gradient_accumulation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Consider 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}$$.
77
In 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
5757
= 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
`` 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

0 commit comments

Comments
 (0)