-
Notifications
You must be signed in to change notification settings - Fork 8
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
Missing rules for SpecialFunctions #412
Comments
Yeah, the problem is that Mooncake can't (currently) handle This is all to say that the only way to support the bessel functions currently is to finish the implementation off. |
@willtebbutt, it is not very clear what is missing here. Can you clarify what |
A good example is something like the method of If you inspect the rule, you will see that (for whatever reason) the authors of SpecialFunctions have not provided the gradient w.r.t. the first argument, and instead return whatever This works well in Zygote, because Zygote defers accumulating gradients until the rule which consumes them is reached. This means that if no rule consumes the In Mooncake we accumulate the results in an eager manner i.e. immediately after the reverse-pass of the rule. This makes the reverse-pass dramatically more simple in general, but has the unfortunate consequence in this case that we can't make use of the |
Hi there!
I saw this Discourse post benchmarking reverse-mode AD on a code with Bessel functions: https://discourse.julialang.org/t/speeding-up-zygote-autodiff-for-numerical-loop/123515/
I tried Mooncake on it but it was missing a rule for
bessely
. When I tried implementing it, I got a weird error message (can't reproduce it here since I'm not on my work computer), which I think may be linked to the partial implementation ofChainRulesCore.rrule
:https://github.com/JuliaMath/SpecialFunctions.jl/blob/ed6a36732712a71e99de397cca45a58432f22a0e/ext/SpecialFunctionsChainRulesCoreExt.jl#L97-L103
Wanna take a look? It would be fun to see how close we can get to Enzyme.
The text was updated successfully, but these errors were encountered: