Skip to content

Commit bf49b66

Browse files
committed
tweak Zygote page
1 parent b9c2352 commit bf49b66

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
77
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
88
OneHotArrays = "0b1bfda6-eb8a-41d2-88d8-f5af5cad476f"
99
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
10+
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1011

1112
[compat]
1213
Documenter = "0.27"

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)