-
Notifications
You must be signed in to change notification settings - Fork 57
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
Custom gradient macro proof of concept #123
Custom gradient macro proof of concept #123
Conversation
I will add some tests once the general approach is approved. Edit: added tests |
@mohamed82008 I want to do
However, this PR still cannot handle keyword arguments. |
@AStupidBear ReverseDiff doesn't seem very actively developed so I have the macro in TuringLang/DistributionsAD.jl#58 hopefully temporarily. I will try to add kwarg support before merging. |
I believe this is ready for a second review. |
Let's get a check from @oxinabox as well. |
@oxinabox can I merge this? |
Ping @oxinabox |
Given the lack of response and given that the tests are passing, I will merge now and release. This is an independent feature so if there are bugs, I can fix them in patch releases later. I need this for other developments in TuringLang, so sorry for my lack of patience. |
Sounds good to me. No worries! |
This PR implements a proof of concept for an
@grad
macro that enables users to define custom gradients for some functions in a user-friendly syntax, identical to Tracker's syntax. Please let me know if I made some obvious mistakes, this is my first contribution to ReverseDiff :)Here is a usage example that is possible with this PR: