Skip to content

Commit df9d08d

Browse files
Merge #1746
1746: Fix Saving and loading model output example r=darsnack a=logankilpatrick Right now, the example here: https://fluxml.ai/Flux.jl/stable/saving/#Saving-and-Loading-Models is incorrect. ```Julia julia> model = Chain(Dense(10,5,relu),Dense(5,2),softmax) Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax) ``` is not what happens and the loading model example at the bottom expects `Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax)` so this fixes this inconsistency. Co-authored-by: Logan Kilpatrick <23kilpatrick23@gmail.com>
2 parents fd6b423 + 61ad437 commit df9d08d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/src/saving.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ Save a model:
99
```julia
1010
julia> using Flux
1111

12-
julia> model = Chain(Dense(10,5,relu),Dense(5,2),softmax)
13-
Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax)
12+
julia> model = Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax)
13+
Chain(
14+
Dense(10, 5, relu), # 55 parameters
15+
Dense(5, 2), # 12 parameters
16+
NNlib.softmax,
17+
) # Total: 4 arrays, 67 parameters, 524 bytes.
1418

1519
julia> using BSON: @save
1620

@@ -27,7 +31,12 @@ julia> using BSON: @load
2731
julia> @load "mymodel.bson" model
2832

2933
julia> model
30-
Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax)
34+
Chain(
35+
Dense(10, 5, relu), # 55 parameters
36+
Dense(5, 2), # 12 parameters
37+
NNlib.softmax,
38+
) # Total: 4 arrays, 67 parameters, 524 bytes.
39+
3140
```
3241

3342
Models are just normal Julia structs, so it's fine to use any Julia storage

0 commit comments

Comments
 (0)