-
Notifications
You must be signed in to change notification settings - Fork 149
Fix deprecation warning introduced by DiffRules v1.4 #553
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
src/dual.jl
Outdated
@@ -392,7 +392,7 @@ Base.float(d::Dual) = convert(float(typeof(d)), d) | |||
# General Mathematical Operations # | |||
################################### | |||
|
|||
for (M, f, arity) in DiffRules.diffrules() | |||
for (M, f, arity) in DiffRules.diffrules(filter_modules = (:Base, :SpecialFunctions, :NaNMath)) |
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 guess one could use the opportunity and already prepare this code for future releases of DiffRules. As stated in the deprecation warning it will change to filter_modules=nothing
, ie. it will load all rules defined in DiffRules. We only had to introduce this keyword argument because many downstream packages, including ForwardDiff, did not actually check if a module M
with a function f
was defined when they tried to load the rules.
So an alternative approach here that would also add derivative definitions for functions in LogExpFunctions would be to:
- add LogExpFunctions >= 0.3 as explicit dependency (it's already an indirect dependency via DiffRules and SpecialFunctions)
- use
DiffRules.diffrules(; filter_modules=nothing)
and load all rules, including the ones for LogExpFunctions - check if
M
andM.f
are defined before trying toeval
the rule definitions
for (M, f, arity) in DiffRules.diffrules(filter_modules = nothing) | ||
if (M, f) in ((:Base, :^), (:NaNMath, :pow), (:Base, :/), (:Base, :+), (:Base, :-)) | ||
continue # Skip methods which we define elsewhere. | ||
elseif !(isdefined(@__MODULE__, M) && isdefined(getfield(@__MODULE__, M), f)) |
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.
Is this a reasonable way to check if M
and f
are defined? Seems a bit clunky.
Why are the tests non-deterministic? Failure on 1.0 isn't caused by this: https://github.com/JuliaDiff/ForwardDiff.jl/runs/4111622597?check_suite_focus=true#step:6:293 |
Tests are passing now thanks to #554. |
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.
LGTM, thanks! 🙂
Any chance we could get this merged and a new release tagged? |
Thanks! |
DiffRules 1.4.0 introduced a new deprecation warning: JuliaDiff/DiffRules.jl#69
This caused the JuMP tests to fail since we run with
--depwarn=error
:https://github.com/jump-dev/JuMP.jl/runs/4110519060?check_suite_focus=true#step:6:26
x-ref: jump-dev/JuMP.jl#2790