-
Notifications
You must be signed in to change notification settings - Fork 38
Added ldexp to list of diffrules #73
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
Conversation
Added a rule for the function ldexp https://docs.julialang.org/en/v1/base/math/#Base.Math.ldexp
Update rules.jl
use exp2 instead of 2^x to avoid overflows, indicate the derivative w.r.t. the second argument of ldexp as not defined since that argument is of integer type. Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
… be an integer and thus non-differentiable. Changed variable name from "non_numeric_arg_functions" to "non_diffable_arg_functions" to be more general and account for the numeric but non-differentiable nature of the second argument of ldexp.
Dear @devmotion , I have now also added a special test rule for ldexp. I tested it locally and I think it works as it is supposed to but the test errors still remain. However, as far as I can see it doesn't have anything to do with my code additions or am I missing something? Can I do anything to move forward with the PR? Thank you! |
Ah, no, nevermind, I see that some are still related to |
Okay, I see that at least the issues with the downstream tests of |
The problem is that these packages define differentiation rules based on the rules in DiffRules automatically and then also test them automatically, without taking into account the types of the arguments of these functions. Of course, this is problematic already for existing rules such as the one for It would be nice for maintainers of these downstream packages if you could prepare PRs that skip these automatic tests also for |
Then let's just merge and leave the rest to downstream? |
Codecov Report
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
+ Coverage 96.95% 96.96% +0.01%
==========================================
Files 3 3
Lines 164 165 +1
==========================================
+ Hits 159 160 +1
Misses 5 5
Continue to review full report at Codecov.
|
Fine with me. I merged the master branch, this should fix the other test errors. |
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.
Seems OK, breaks ForwardDiff's tests but won't break actual usage.
Thank you @david-hofmann! |
Added a rule for the function ldexp