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

Preserve 0d arrays in Zygote.accum #1491

Merged
merged 2 commits into from
Jan 16, 2024
Merged

Preserve 0d arrays in Zygote.accum #1491

merged 2 commits into from
Jan 16, 2024

Conversation

lxvm
Copy link
Contributor

@lxvm lxvm commented Jan 3, 2024

Zygote.accum mirrored an old Julia bug that got fixed by Julia 1.6, which is the version supported by Zygote. This pr changes the behavior to match Julia's

PR Checklist

  • Tests are added
  • Documentation, if applicable

@mcabbott
Copy link
Member

mcabbott commented Jan 3, 2024

Do you have an example of user-facing code which triggers this?

julia> gradient(x -> first(x) + sum(x), fill(1.0))[1]
0-dimensional Array{Float64, 0}:
2.0

@lxvm
Copy link
Contributor Author

lxvm commented Jan 3, 2024

Yes, it's #1490

Copy link
Member

@darsnack darsnack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this on call and agree with the change. The behavior of accum should match x + y not x .+ y.

@lxvm
Copy link
Contributor Author

lxvm commented Jan 14, 2024

Great, I've rebased this on master so it should be ready to go

@ToucheSir ToucheSir merged commit 5b61724 into FluxML:master Jan 16, 2024
8 of 13 checks passed
@lxvm lxvm deleted the zerod branch January 16, 2024 03:57
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 this pull request may close these issues.

4 participants