@@ -12,6 +12,8 @@ Can be applied to the state corresponding to only part of a model,
1212for instance with `model::Chain`, to freeze `model.layers[1]` you
1313should call `freeze!(tree.layers[1])`.
1414
15+ Also prevents [`adjust`](@ref Optimisers.adjust) from changing the rule's parameters.
16+
1517# Example
1618```jldoctest
1719julia> m = (x = ([1.0], 2.0), y = [3.0]);
@@ -64,6 +66,8 @@ through training.
6466
6567To change just the learning rate, provide a number `η::Real`.
6668
69+ Does not affect any frozen parameters, set by [`freeze!`](@ref Optimisers.freeze!).
70+
6771# Example
6872```jldoctest
6973julia> m = (vec = rand(Float32, 2), fun = sin);
@@ -103,8 +107,8 @@ adjust(tree; kw...) = map(st -> adjust(st; kw...), tree)
103107adjust (:: Nothing , :: Real ) = nothing
104108adjust (:: Nothing ; kw... ) = nothing
105109
106- adjust (ℓ:: Leaf , eta:: Real ) = Leaf (adjust (ℓ. rule, eta), ℓ. state)
107- adjust (ℓ:: Leaf ; kw... ) = Leaf (adjust (ℓ. rule; kw... ), ℓ. state)
110+ adjust (ℓ:: Leaf , eta:: Real ) = ℓ . frozen ? ℓ : Leaf (adjust (ℓ. rule, eta), ℓ. state)
111+ adjust (ℓ:: Leaf ; kw... ) = ℓ . frozen ? ℓ : Leaf (adjust (ℓ. rule; kw... ), ℓ. state)
108112
109113
110114"""
0 commit comments