Skip to content

Commit c7ed3fd

Browse files
committed
fix doctest
1 parent 113c097 commit c7ed3fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/interface.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ as a named tuple.
115115
julia> y, ∇ = withgradient(/, 1, 2)
116116
(val = 0.5, grad = (0.5, -0.25))
117117
118-
julia> ∇ == gradient(/, 1, 2) # explicit mode
118+
julia> ∇ == gradient(/, 1, 2)
119119
true
120-
121-
julia> w = [3.0];
122120
```
123121
124122
If `f` returns a Tuple or NamedTuple, then it calculates
@@ -140,7 +138,9 @@ julia> withgradient(3.0, 4.0) do x, y
140138
Also supports implicit mode:
141139
142140
```jldoctest; setup=:(using Zygote)
143-
julia> res = withgradient(() -> sum(abs2, w), Params([w])) # implicit mode
141+
julia> w = [3.0];
142+
143+
julia> res = withgradient(() -> sum(abs2, w), Params([w]))
144144
(val = 9.0, grad = Grads(...))
145145
146146
julia> res.grad[w]

0 commit comments

Comments
 (0)