-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Changing Distances adjoints to ChainRules syntax #923
Conversation
Lgtm for the most part. |
|
Sorry, I made a mistake: trying JuliaGaussianProcesses/KernelFunctions.jl#208 with this branch does not seem to solve the problem. Also precompiling this patch returns a surprising warning: ┌ Warning: Error requiring `Distances` from `Zygote`
│ exception =
│ LoadError: error in method definition: function ChainRulesCore.rrule must be explicitly imported to be extended
... |
Yeah, so we usually move the adjoints over, but since ChainRules is a dep, you could add the import |
@theogf I know you've resolved this on your end now, but would you be up for pushing this PR through anyway? Seems like something that we should be doing throughout |
It seems the adjoint definitions have to be updated to the ChainRules-syntax? In particular, I guess |
|
I am not sure the failing checks are related to this PR... |
Doesn't look related to me. @theogf I reckon this is basically good to go after a patch bump. I'll bors it after that unless @DhairyaLGandhi has any objections? |
There was a merge conflict, otherwise lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would also be good to add some tests with ChainRulesTestUtils.test_rrule.
Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
needs a rebase, otherwise seems a sensible change |
I wonder if possibly maintainers of Distances who didn't want to add a dependency on ChainRulesCore might be fine with adding it as a weak dependency? |
CI is complaining about a |
Using @adjoint disable the overloading of
rrule
see : JuliaDiff/ChainRulesCore.jl#239 (comment)It makes it impossible to define new rules for different metrics.
I am aware that the long-term plan is to move out the rules to the respective packages but in the mean-time it would be nice for it to be solved (it blocks our development in JuliaGaussianProcesses/KernelFunctions.jl#208).