ForwardDiff.jl
ForwardDiff.jl copied to clipboard
dynamic NaN-safe mode switching
Follow-up issue to #179. From my comment there:
In a future PR, we could add
AbstractConfig
constructors likeGradientConfig(x, Chunk{N}, NaNSafe{true})
. The generated dual numbers would then contain partials of typePartials{N,T,true}
, which would dispatch to theNaN
-safe versions of methods. Downstream modules could then support passing that option through their APIs (or simply setting it to a reasonable default for themselves internally).
This would be very nice to have!
Is it possible we could use Preferences.jl to enable/disable NaN-safe mode now? See https://github.com/JuliaLang/Pkg.jl/issues/458. I think that would effectively solve this long-standing issue.
NaN-safe mode switching via the Preferences.jl system was added in https://github.com/JuliaDiff/ForwardDiff.jl/pull/539.