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

Autodiff backends #71

Closed
lostella opened this issue Feb 25, 2022 · 7 comments · Fixed by #90
Closed

Autodiff backends #71

lostella opened this issue Feb 25, 2022 · 7 comments · Fixed by #90

Comments

@lostella
Copy link
Member

Right now the package falls back to Zygote for computing gradients using automatic differentiation. It would be nice to add support for multiple AD backends (ReverseDiff, Enzyme, Yota, Nabla, Diffractor… anything that works) so that one can chose what should be used.

This would require a mechanism for “optional dependencies”, so that a certain backend can be used only if the required dependency is installed.

Two ways I see for selecting what backend to use:

  1. Some global variable
  2. Wrapping functions in a specific type that enforces using this or that AD backend, eg, ZygoteFunction(f), ReverseDiffFunction(f), …
@nantonel
Copy link
Collaborator

isn't ChainRulesCore the AD core package?

@lostella
Copy link
Member Author

lostella commented Feb 26, 2022 via email

@mohamed82008
Copy link

Check https://github.com/JuliaDiff/AbstractDifferentiation.jl and the associated paper https://arxiv.org/abs/2109.12449.

@lostella
Copy link
Member Author

@mohamed82008 thanks, it seemed to much of a general issue not to have a solution already :-) now I’m curious, I’ll look into that

@mohamed82008
Copy link

mohamed82008 commented Feb 26, 2022

Feel free to ping me if you have any questions :) I always wanted to add nonconvex optimisation support to ProximalAlgorithms but didn't get a chance to. If I understand correctly, nonconvex functions and constraints are now supported via AD?

@lostella
Copy link
Member Author

lostella commented Feb 26, 2022

@mohamed82008 ProximalAlgorithms supports nonconvex problems, in the sense that some of the implemented algorithms don’t need convexity assumptions on the objective terms in order to converge.

AD (Zygote right now) is used by default to compute gradients when they are needed. Constraints are handled via their projection mapping, and more generally non-differentiable terms are handled via proximal mappings (projections are a special case of this).

Here is a little bit of documentation on the primitives which are used, and that one can implement on custom types.

@mohamed82008
Copy link

Fantastic! Exactly what I was hoping for. Thanks!

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 a pull request may close this issue.

3 participants