Skip to content
New issue

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

tests are failing due to ComponentArrays #2411

Closed
CarloLucibello opened this issue Mar 26, 2024 · 2 comments · Fixed by #2419
Closed

tests are failing due to ComponentArrays #2411

CarloLucibello opened this issue Mar 26, 2024 · 2 comments · Fixed by #2419

Comments

@CarloLucibello
Copy link
Member

on a recent CI run
https://github.com/FluxML/Flux.jl/actions/runs/8411429678/job/23031003428?pr=2409#step:7:561

@CarloLucibello
Copy link
Member Author

It appears that recent changes in ComponentArrays.jl have broken the parameter collection.

On ComponentArrays v0.15.10 we had

julia> using Flux, ComponentArrays

julia> w = ComponentArray(a=1.0, b=[2, 1, 4], c=(a=2, b=[1, 2]))
ComponentVector{Float64}(a = 1.0, b = [2.0, 1.0, 4.0], c = (a = 2.0, b = [1.0, 2.0]))

julia> ps = Flux.params(w)
Params([(a = 1.0, b = [2.0, 1.0, 4.0], c = (a = 2.0, b = [1.0, 2.0]))])

julia> ps[1]
ComponentVector{Float64}(a = 1.0, b = [2.0, 1.0, 4.0], c = (a = 2.0, b = [1.0, 2.0]))

julia> gs = gradient(() -> sum(w.a) + sum(w.c.b), ps)
Grads(...)

julia> gradient(() -> sum(w.a) + sum(w.c.b), ps)[ps[1]]
ComponentVector{Float64}(a = 1.0, b = [0.0, 0.0, 0.0], c = (a = 0.0, b = [1.0, 1.0]))

On ComponentArrays v0.15.11 instead

julia> w = ComponentArray(a=1.0, b=[2, 1, 4], c=(a=2, b=[1, 2]))
ComponentVector{Float64}(a = 1.0, b = [2.0, 1.0, 4.0], c = (a = 2.0, b = [1.0, 2.0]))

julia> ps = Flux.params(w)
Params([[2.0, 1.0, 4.0], [1.0, 2.0]])

julia> ps[1]
3-element Vector{Float64}:
 2.0
 1.0
 4.0

julia> gs = gradient(() -> sum(w.a) + sum(w.c.b), ps)
Grads(...)

julia> gradient(() -> sum(w.a) + sum(w.c.b), ps)[ps[1]] # nothing

Could jonniedie/ComponentArrays.jl#252 be the responsible? cc @avik-pal

@avik-pal
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants