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

Error with Flux GRU layer #1261

Closed
jgreener64 opened this issue Jan 29, 2024 · 3 comments
Closed

Error with Flux GRU layer #1261

jgreener64 opened this issue Jan 29, 2024 · 3 comments

Comments

@jgreener64
Copy link
Contributor

I am on Julia 1.10.0, Enzyme main (ba58bcb) and Flux 0.14.10.

using Enzyme, Flux
loss(model, x) = sum(model(x))
model = GRU(3 => 5)
x = randn(Float32, 3, 10)
d_model = Flux.fmap(model) do x
    x isa Array ? zero(x) : x
end
Enzyme.autodiff(Reverse, loss, Active, Duplicated(model, d_model), Const(x))

See the error.txt and the printall_error.txt.

@wsmoses
Copy link
Member

wsmoses commented Feb 9, 2024

Are you able to minimize this by chance (and potentially open issues for the other problems you found)?

@jgreener64
Copy link
Contributor Author

jgreener64 commented Mar 10, 2024

I think this is the minimal error. On Enzyme main (5e4e2ef) and Julia 1.10.2:

using Enzyme

loss(gxs, ghs) = sum(gxs .+ ghs)

gxs = rand(5, 10)
ghs = rand(5)

# Comment out the next two lines and it works
gxs = view(gxs, 1:5, 1:10)
ghs = view(ghs, 1:5)

loss(gxs, ghs)

autodiff(
    Reverse,
    loss,
    Active,
    Duplicated(gxs, gxs),
    Duplicated(ghs, ghs),
)

The error.txt and printall_error.txt are attached.

@wsmoses
Copy link
Member

wsmoses commented May 7, 2024

@jgreener64 @CarloLucibello the last example now works on main, going to close this. Please reopen if it persists.

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

No branches or pull requests

2 participants