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

Support f!(y, x) for Zygote with Zygote.Buffer #348

Closed
gdalle opened this issue Jul 13, 2024 · 4 comments
Closed

Support f!(y, x) for Zygote with Zygote.Buffer #348

gdalle opened this issue Jul 13, 2024 · 4 comments
Labels
backend Related to one or more autodiff backends

Comments

@gdalle
Copy link
Owner

gdalle commented Jul 13, 2024

See https://fluxml.ai/Zygote.jl/stable/utils/#Zygote.Buffer

Ping @Vaibhavdixit02

@gdalle gdalle added the backend Related to one or more autodiff backends label Jul 13, 2024
@gdalle gdalle linked a pull request Jul 16, 2024 that will close this issue
@gdalle
Copy link
Owner Author

gdalle commented Jul 16, 2024

PR #360 fails because

Buffer is not an AbstractArray and can't be used for linear algebra operations like matrix multiplication. This prevents it from being captured by pullbacks.

and some functions are typed f!(y::AbstractArray, x::AbstractArray). I think in general this fix would only cover a very limited subset of possible mutating operations, so I'm not sure it's worth it

@Vaibhavdixit02
Copy link
Contributor

Wait, I think the main thing it does, and what I had in mind asking for it was supporting in-place functions that's it. It has been quite robust in my experience and by documenting that the extent of mutation here is just in-place function calls why is this not worth it? Doesn't that mean that you'd be able to mark off the Two-argument column for Zygote here https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterface/dev/backends/#Features?

@gdalle
Copy link
Owner Author

gdalle commented Aug 2, 2024

Gonna give it another try. Hopefully all it takes is to remove a few type annotations for my test suite to pass

@gdalle
Copy link
Owner Author

gdalle commented Sep 5, 2024

Buffer was discussed on Slack today and described as very hacky and buggy, so I think this feature would cause more harm than good in the end.

@gdalle gdalle closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to one or more autodiff backends
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants