Skip to content

Commit

Permalink
fix doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Jun 19, 2023
1 parent 113c097 commit c7ed3fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compiler/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ as a named tuple.
julia> y, ∇ = withgradient(/, 1, 2)
(val = 0.5, grad = (0.5, -0.25))
julia> ∇ == gradient(/, 1, 2) # explicit mode
julia> ∇ == gradient(/, 1, 2)
true
julia> w = [3.0];
```
If `f` returns a Tuple or NamedTuple, then it calculates
Expand All @@ -140,7 +138,9 @@ julia> withgradient(3.0, 4.0) do x, y
Also supports implicit mode:
```jldoctest; setup=:(using Zygote)
julia> res = withgradient(() -> sum(abs2, w), Params([w])) # implicit mode
julia> w = [3.0];
julia> res = withgradient(() -> sum(abs2, w), Params([w]))
(val = 9.0, grad = Grads(...))
julia> res.grad[w]
Expand Down

0 comments on commit c7ed3fd

Please sign in to comment.