Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Nov 26, 2024
1 parent 2a9228d commit 443d3b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion docs/src/guide/saving.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ julia> Flux.@layer MyModel
julia> MyModel() = MyModel(Chain(Dense(10 => 5, relu), Dense(5 => 2)));
julia> model = MyModel()
MyModel(Chain(Dense(10 => 5, relu), Dense(5 => 2))) # 67 parameters
MyModel(
Chain(
Dense(10 => 5, relu), # 55 parameters
Dense(5 => 2), # 12 parameters
),
) # Total: 4 arrays, 67 parameters, 484 bytes.
julia> model_state = Flux.state(model);
Expand Down
10 changes: 5 additions & 5 deletions src/layers/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Trio(
Dropout(0.4),
) # Total: 3 arrays, 4 parameters, 240 bytes.
# Freeze `c`, equivalent to `Optimisers.trainable(tri::Trio) = (; tri.a, tri.b)`
julia> Flux.@layer Trio trainable=(a,b)
julia> Flux.@layer :noexpand Trio trainable=(a,b)
# Now the optimizer's state won't contain `c`
julia> opt_state = Flux.setup(Adam(), tri);
```
julia> tri # now the layer is printed compactly
Trio(Dense(2 => 1, tanh), Dense(1 => 1; bias=false), Dropout(0.4)) # 4 parameters
julia> opt_state = Flux.setup(Adam(), tri); # `c` is not in the optimizer state
```
"""
macro layer(exs...)
_layer_macro(exs...)
Expand Down

0 comments on commit 443d3b3

Please sign in to comment.