Skip to content

Commit 3c935cc

Browse files
authored
Add MLUtils's docs and fix some missing docstrings (#1910)
* Add `MLUtils` to doc dependencies and fix missing `DataLoader` docstring * Fix `siamese_contrastive_loss` docs * Fix `Flux.flatten` docs * Create `mlutils.md` * Change relative path for `MLUtils` * `H2` heading -> `H1` heading
1 parent 81eea84 commit 3c935cc

File tree

9 files changed

+42
-35
lines changed

9 files changed

+42
-35
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
44
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
5+
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54"
56

67
[compat]
78
Documenter = "0.26"

docs/make.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using Documenter, Flux, NNlib, Functors
1+
using Documenter, Flux, NNlib, Functors, MLUtils
22

33
DocMeta.setdocmeta!(Flux, :DocTestSetup, :(using Flux); recursive = true)
4-
makedocs(modules = [Flux, NNlib, Functors],
4+
makedocs(modules = [Flux, NNlib, Functors, MLUtils],
55
doctest = VERSION == v"1.5",
66
sitename = "Flux",
77
pages = ["Home" => "index.md",
@@ -17,7 +17,7 @@ makedocs(modules = [Flux, NNlib, Functors],
1717
"Functors" => "models/functors.md"],
1818
"Handling Data" =>
1919
["One-Hot Encoding" => "data/onehot.md",
20-
"DataLoader" => "data/dataloader.md"],
20+
"MLUtils" => "data/mlutils.md"],
2121
"Training Models" =>
2222
["Optimisers" => "training/optimisers.md",
2323
"Training" => "training/training.md"],

docs/src/data/dataloader.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/src/data/mlutils.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# MLUtils.jl
2+
3+
Flux re-exports the `DataLoader` type and utility functions for working with
4+
data from [MLUtils](https://github.com/JuliaML/MLUtils.jl).
5+
6+
## DataLoader
7+
8+
`DataLoader` can be used to handle iteration over mini-batches of data.
9+
10+
```@docs
11+
MLUtils.DataLoader
12+
```
13+
14+
## Utility functions for working with data
15+
16+
The utility functions are meant to be used while working with data;
17+
these functions help create inputs for your models or batch your dataset.
18+
19+
Below is a non-exhaustive list of such utility functions.
20+
21+
```@docs
22+
MLUtils.unsqueeze
23+
MLUtils.stack
24+
MLUtils.unstack
25+
MLUtils.chunk
26+
MLUtils.group_counts
27+
MLUtils.batch
28+
MLUtils.unbatch
29+
MLUtils.batchseq
30+
MLUtils.rpad(v::AbstractVector, n::Integer, p)
31+
```

docs/src/models/functors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## Functors.jl
1+
# Functors.jl
22

3-
Flux makes use of the Functors.jl to represent many of the core functionalities it provides.
3+
Flux makes use of the [Functors.jl](https://github.com/FluxML/Functors.jl) to represent many of the core functionalities it provides.
44

55
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.
66

docs/src/models/layers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DepthwiseConv
2323
ConvTranspose
2424
CrossCor
2525
SamePad
26-
flatten
26+
Flux.flatten
2727
Flux.convfilter
2828
Flux.depthwiseconvfilter
2929
```

docs/src/models/losses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ Flux.Losses.dice_coeff_loss
4141
Flux.Losses.tversky_loss
4242
Flux.Losses.binary_focal_loss
4343
Flux.Losses.focal_loss
44-
Flux.losses.siamese_contrastive_loss
44+
Flux.Losses.siamese_contrastive_loss
4545
```

docs/src/models/nnlib.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# NNlib
1+
# NNlib.jl
22

33
Flux re-exports all of the functions exported by the [NNlib](https://github.com/FluxML/NNlib.jl) package.
44

docs/src/utilities.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
# Utility Functions
22

3-
Flux contains some utility functions for working with data; these functions
4-
help create inputs for your models or batch your dataset.
5-
Other functions can be used to initialize your layers or to regularly execute
6-
callback functions.
7-
8-
## Working with Data
9-
10-
Utilities for data processing are provided by [MLUtils.jl](https://github.com/JuliaML/MLUtils.jl). Below is a non-exhaustive list.
11-
12-
```@docs
13-
MLUtils.unsqueeze
14-
MLUtils.stack
15-
MLUtils.unstack
16-
MLUtils.chunk
17-
MLUtils.group_counts
18-
MLUtils.batch
19-
MLUtils.unbatch
20-
MLUtils.batchseq
21-
Base.rpad(v::AbstractVector, n::Integer, p)
22-
```
3+
Flux provides utility functions which can be used to initialize your layers
4+
or to regularly execute callback functions.
235

246
## Layer Initialization
257

0 commit comments

Comments
 (0)