We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trainables
julia> using Optimisers julia> mutable struct Two{T}; x::T; y::T; Two(x::T) where T = new{T}(x) end julia> Optimisers.trainable(z::Two) = (; z.x) julia> t = Two([1,2,3.]) Two{Vector{Float64}}([1.0, 2.0, 3.0], #undef) julia> t.y = [4,5,6.]; julia> t Two{Vector{Float64}}([1.0, 2.0, 3.0], [4.0, 5.0, 6.0]) julia> Optimisers.trainables(t) # this is fine! Only needs to look at t.x 1-element Vector{AbstractArray}: [1.0, 2.0, 3.0] julia> t1 = Two([7,8,9.]) Two{Vector{Float64}}([7.0, 8.0, 9.0], #undef) julia> Optimisers.trainables(t1) # Still only needs to look at t1.x ERROR: UndefRefError: access to undefined reference Stacktrace: [1] #2 @ ~/.julia/packages/Functors/LbNAu/src/functor.jl:21 [inlined] [2] ntuple @ ./ntuple.jl:19 [inlined] [3] functor @ ~/.julia/packages/Functors/LbNAu/src/functor.jl:21 [inlined] [4] functor @ ~/.julia/packages/Functors/LbNAu/src/functor.jl:25 [inlined] [5] children @ ~/.julia/packages/Functors/LbNAu/src/functor.jl:58 [inlined] [6] isleaf @ ~/.julia/packages/Functors/LbNAu/src/functor.jl:56 [inlined] [7] usecache @ ~/.julia/packages/Functors/LbNAu/src/walks.jl:141 [inlined] [8] (::Functors.CachedWalk{…})(::Function, ::Two{…}) @ Functors ~/.julia/packages/Functors/LbNAu/src/walks.jl:173 [9] execute @ ~/.julia/packages/Functors/LbNAu/src/walks.jl:55 [inlined] [10] #fmap#41 @ ~/.julia/packages/Functors/LbNAu/src/maps.jl:11 [inlined] [11] fmap @ ~/.julia/packages/Functors/LbNAu/src/maps.jl:3 [inlined] [12] _trainables @ ~/.julia/packages/Optimisers/FES4P/src/trainables.jl:70 [inlined] [13] trainables(x::Two{Vector{Float64}}; path::Bool) @ Optimisers ~/.julia/packages/Optimisers/FES4P/src/trainables.jl:63 [14] trainables(x::Two{Vector{Float64}}) @ Optimisers ~/.julia/packages/Optimisers/FES4P/src/trainables.jl:59 [15] top-level scope @ REPL[37]:1 Some type information was truncated. Use `show(err)` to see complete types.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: