@@ -12,6 +12,8 @@ Can be applied to the state corresponding to only part of a model,
12
12
for instance with `model::Chain`, to freeze `model.layers[1]` you
13
13
should call `freeze!(tree.layers[1])`.
14
14
15
+ Also prevents [`adjust`](@ref Optimisers.adjust) from changing the rule's parameters.
16
+
15
17
# Example
16
18
```jldoctest
17
19
julia> m = (x = ([1.0], 2.0), y = [3.0]);
@@ -64,6 +66,8 @@ through training.
64
66
65
67
To change just the learning rate, provide a number `η::Real`.
66
68
69
+ Does not affect any frozen parameters, set by [`freeze!`](@ref Optimisers.freeze!).
70
+
67
71
# Example
68
72
```jldoctest
69
73
julia> m = (vec = rand(Float32, 2), fun = sin);
@@ -103,8 +107,8 @@ adjust(tree; kw...) = map(st -> adjust(st; kw...), tree)
103
107
adjust (:: Nothing , :: Real ) = nothing
104
108
adjust (:: Nothing ; kw... ) = nothing
105
109
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)
108
112
109
113
110
114
"""
0 commit comments