Skip to content

Commit

Permalink
Make private for now
Browse files Browse the repository at this point in the history
  • Loading branch information
darsnack committed Sep 4, 2022
1 parent 7c8fad5 commit 80fb0f1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
3 changes: 0 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Flux Release Notes

## v0.13.5
* `loadmodel!` now supports a [`filter` keyword argument](https://github.com/FluxML/Flux.jl/pull/2041)

## v0.13.4
* Added [`PairwiseFusion` layer](https://github.com/FluxML/Flux.jl/pull/1983)

Expand Down
18 changes: 1 addition & 17 deletions src/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _filter_children(f, children::NamedTuple) =
_filter_children(f, children) = filter(f, children)

"""
loadmodel!(dst, src; filter = _ -> true)
loadmodel!(dst, src)
Copy all the parameters (trainable and non-trainable) from `src` into `dst`.
Expand All @@ -43,9 +43,6 @@ Non-array elements (such as activation functions) are not copied and need not ma
Zero bias vectors and `bias=false` are considered equivalent
(see extended help for more details).
Specify the predicate function `filter` to control what is recursed.
A child node `x` in either `dst` and `src` is skipped when `filter(x) == false`.
# Examples
```julia
julia> dst = Chain(Dense(Flux.ones32(2, 5), Flux.ones32(2), tanh), Dense(2 => 1; bias = [1f0]))
Expand All @@ -66,19 +63,6 @@ false
julia> iszero(dst[2].bias)
true
julia> src = Chain(Dense(5 => 2), Dropout(0.2), Dense(2 => 1))
Chain(
Dense(5 => 2), # 12 parameters
Dropout(0.2),
Dense(2 => 1), # 3 parameters
) # Total: 4 arrays, 15 parameters, 348 bytes.
julia> Flux.loadmodel!(dst, src; filter = x -> !(x isa Dropout)) # skips loading Dropout
Chain(
Dense(5 => 2, tanh), # 12 parameters
Dense(2 => 1), # 3 parameters
) # Total: 4 arrays, 15 parameters, 316 bytes.
```
# Extended help
Expand Down

0 comments on commit 80fb0f1

Please sign in to comment.