@@ -77,7 +77,7 @@ or [`update!`](@ref).
7777julia> m = (x = rand(3), y = (true, false), z = tanh);
7878
7979julia> Optimisers.setup(Momentum(), m) # same field names as m
80- (x = Leaf(Momentum{Float32}(0.01, 0.9), [0.0, 0.0, 0.0]), y = (nothing, nothing) , z = nothing )
80+ (x = Leaf(Momentum{Float32}(0.01, 0.9), [0.0, 0.0, 0.0]), y = ((), ()) , z = () )
8181```
8282
8383The recursion into structures uses Functors.jl, and any new `struct`s containing parameters
@@ -90,15 +90,15 @@ julia> struct Layer; mat; fun; end
9090julia> model = (lay = Layer([1 2; 3 4f0], sin), vec = [5, 6f0]);
9191
9292julia> Optimisers.setup(Momentum(), model) # new struct is by default ignored
93- (lay = nothing , vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
93+ (lay = () , vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
9494
9595julia> destructure(model)
9696(Float32[5.0, 6.0], Restructure(NamedTuple, ..., 2))
9797
9898julia> using Functors; @functor Layer # annotate this type as containing parameters
9999
100100julia> Optimisers.setup(Momentum(), model)
101- (lay = (mat = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0 0.0; 0.0 0.0]), fun = nothing ), vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
101+ (lay = (mat = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0 0.0; 0.0 0.0]), fun = () ), vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
102102
103103julia> destructure(model)
104104(Float32[1.0, 3.0, 2.0, 4.0, 5.0, 6.0], Restructure(NamedTuple, ..., 6))
@@ -120,12 +120,12 @@ See also [`update!`](@ref), which will be faster for models of ordinary `Array`s
120120julia> m = (x = Float32[1,2,3], y = tanh);
121121
122122julia> t = Optimisers.setup(Descent(0.1f0), m)
123- (x = Leaf(Descent{Float32}(0.1), nothing), y = nothing )
123+ (x = Leaf(Descent{Float32}(0.1), nothing), y = () )
124124
125125julia> g = (x = [1,1,1], y = nothing); # fake gradient
126126
127127julia> Optimisers.update(t, m, g)
128- ((x = Leaf(Descent{Float32}(0.1), nothing), y = nothing ), (x = Float32[0.9, 1.9, 2.9], y = tanh))
128+ ((x = Leaf(Descent{Float32}(0.1), nothing), y = () ), (x = Float32[0.9, 1.9, 2.9], y = tanh))
129129```
130130"""
131131update
0 commit comments