Skip to content

Commit 2fe8c10

Browse files
committed
Mention a couple of examples for Functors.jl
1 parent 7b03e51 commit 2fe8c10

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/src/models/functors.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
Flux models are deeply nested structures, and [Functors.jl](https://github.com/FluxML/Functors.jl) provides tools needed to explore such objects, apply functions to the parameters they contain, and re-build them.
44

5-
Functors.jl is a collection of tools designed to represent a [functor](https://en.wikipedia.org/wiki/Functor_(functional_programming)). Flux makes use of it to treat certain structs as functors. Notable examples include the layers that Flux defines.
5+
More precisely, using the `Functors.@functor` macro allows `Flux` layers to access additional functionalities, like collecting parameters or scaling them to the GPU.
6+
7+
Functors.jl is a collection of tools designed to represent a [functor](https://en.wikipedia.org/wiki/Functor_(functional_programming)). Flux makes use of it to treat certain structs as functors. Notable examples include the layers that Flux defines. The basic usage of `Functors.jl` can be found [here](https://fluxml.ai/Functors.jl/stable/#Basic-Usage-and-Implementation).
68

79
```@docs
10+
Functors.@functor
11+
Functors.fmap
812
Functors.isleaf
913
Functors.children
1014
Functors.fcollect
1115
Functors.functor
12-
Functors.@functor
13-
Functors.fmap
1416
Functors.fmapstructure
1517
```

0 commit comments

Comments
 (0)