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

Splatting gives an incorrect tuple return type on the gradient #1522

Open
ChrisRackauckas opened this issue Sep 8, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ChrisRackauckas
Copy link
Member

MWE:

using Flux
ann = Chain(Dense(5, 50, tanh), Dense(50, 4))
p, st = Flux.destructure(ann)
u0 = rand(5)

using Zygote
function dudt_(u, p, t)
    st(p)([u..., 1f1])
end
out, back = Zygote.pullback(dudt_, u0, p, 0f0)
d_u, d_p, d_t = back(rand(4))
typeof(d_u) # NTuple

d_u should be a vector but instead it becomes a tuple. This goes away if the function is instead:

function dudt_(u, p, t)
    st(p)([u;1f1])
end

This was isolated from SciML/SciMLSensitivity.jl#1082

@mcabbott
Copy link
Member

mcabbott commented Sep 9, 2024

Dup of #599 I think. There's a PR which could be revived.

@mcabbott mcabbott added the bug Something isn't working label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants