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

device movement behavior inconsistent #2513

Open
chengchingwen opened this issue Nov 3, 2024 · 1 comment
Open

device movement behavior inconsistent #2513

chengchingwen opened this issue Nov 3, 2024 · 1 comment

Comments

@chengchingwen
Copy link
Member

julia> using Flux, CUDA

julia> x = randn(5); x2 = (x, x); cx2 = gpu(x2);

julia> cx2[1] === cx2[2] # Flux v0.14.24
false

julia> cx2[1] === cx2[2] # Flux v0.14.20
true

It would cause problems for weight sharing. Probably due to #2502

@CarloLucibello
Copy link
Member

This issue is due to MLDataDevices specializing on tuples and not keeping an IdDict for those. It should be fixed.

For functor types instead it works as expected:

julia> struct A; x; y; end

julia> Functors.@functor A

julia> a = A(x, x);

julia> ca = gpu(a);

julia> ca.x === ca.y # Flux v0.14.24
true

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

No branches or pull requests

3 participants