Skip to content

Commit 731b163

Browse files
committed
tweak Zygote page
1 parent b9c2352 commit 731b163

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

docs/src/training/zygote.md

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

33
Flux re-exports the `gradient` from [Zygote](https://github.com/FluxML/Zygote.jl), and uses this function within [`train!`](@ref) to differentiate the model. Zygote has its own [documentation](https://fluxml.ai/Zygote.jl/dev/), in particulat listing some [limitations](https://fluxml.ai/Zygote.jl/dev/limitations/).
44

5+
### Implicit style
6+
7+
Flux uses primarily what Zygote calls "implicit" gradients, [described here](https://fluxml.ai/Zygote.jl/dev/#Explicit-and-Implicit-Parameters-1) in its documentation.
8+
59
```@docs
6-
Zygote.gradient
7-
Zygote.jacobian
8-
Zygote.withgradient
10+
Zygote.gradient(f, pars::Zygote.Params)
11+
Zygote.Params
12+
Zygote.Grads
913
```
1014

15+
### Explicit style
16+
17+
The other way of using Zygote, and using most other AD packages, is to explicitly provide a function and its arguments.
18+
19+
```@docs
20+
Zygote.gradient(f, args...)
21+
Zygote.withgradient(f, args...)
22+
Zygote.jacobian(f, args...)
23+
```
24+
25+
26+
### ChainRules
27+
1128
Sometimes it is necessary to exclude some code, or a whole function, from automatic differentiation. This can be done using [ChainRules](https://github.com/JuliaDiff/ChainRules.jl):
1229

1330
```@docs

0 commit comments

Comments
 (0)