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

Opt out of CR.rrule if pullback is not defined #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devmotion
Copy link

This came up in JuliaGaussianProcesses/KernelFunctions.jl#386:

Sometimes you might want to use grad=false, e.g., if there is neither a rule in DiffRule nor do you want to use ForwardDiff. However, in this case the rrule will always error, even if your CR-compatible AD system could differentiate through your function just fine. This PR adds an opt-out definition if no pullback is defined so that the AD system can take over.

Caveat: I don't think it's very useful in practice currently since (almost?) no CR-compatible AD system supports mutation. E.g., Zygote will just throw a mutation error instead of the custom error in the rrule definition. Therefore I'm not sure how useful this PR is currently (and I'm not sure how to test it properly...).

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.

1 participant