Closed
Description
Several methods from SpecialFunctions.jl are not respecting the numerical precision of the primal:
julia> using ChainRules, SpecialFunctions
julia> y, ȳ = ChainRules.rrule(SpecialFunctions.erf, 1.0f0)
(0.8427008f0, SpecialFunctions.var"#erf_pullback#12"{Float32}(1.0f0))
julia> ȳ(1.0f0)[2]
0.41510750774498784
I'm guessing this is because the rules were originally copy-pasted from DiffRules.jl which suffers from the same issue: JuliaDiff/DiffRules.jl#55.
I think I'm currently of the opinion that the best way to fix this is to copy-paste the constants from e.g. StatsFuns.jl to remove most of the promotions, and then I guess we'll have to use oftype
for the remainders.
Is there a better solution?
Btw, I know this related to other issues, e.g. #232, but to me it seems like this particular case is non-ambiguous and can be easily fixed so might as well do it asap:)
Metadata
Metadata
Assignees
Labels
No labels