diff --git a/NEWS.md b/NEWS.md index 2c18102661..9bf97ddb3b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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) diff --git a/src/loading.jl b/src/loading.jl index 26aa34f104..74d9c35685 100644 --- a/src/loading.jl +++ b/src/loading.jl @@ -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`. @@ -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])) @@ -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