-
Notifications
You must be signed in to change notification settings - Fork 145
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
ldexp does not maintain type of Float32 arguments #604
Comments
Some rules there contain |
Good point! I was being silly, it looks like defining the rule as @define_diffrule Base.ldexp(x, y) = :( z = exp2(one(float($x)) * $y) ), :NaN fixes this. I'll file an issue at DiffRules tomorrow. |
Oh right. I was looking at the wrong bit. Another option might be |
Fixed in JuliaDiff/DiffRules.jl#89 |
Hi,
I uncovered this during FluxML/Zygote.jl#1324 (see comment FluxML/Zygote.jl#1324 (comment)). The specific rule is
https://github.com/JuliaDiff/DiffRules.jl/blob/489e2942e10776c96ab70c5044f595951bbbcaab/src/rules.jl#L88
The use of NaN for the second argument the following branch
Tracking this down it appears this is because the diff rule for ldexp is
and since
y
is anInt
,exp2(y)
returns a Float64. I was originally going to file this as an issue inDiffRules.jl
but I couldn't figure out how change the rule to respectFloat32
.The text was updated successfully, but these errors were encountered: