-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
wrong gradient type when dividing by integer #727
Closed
Comments
Is this the rule used? Should we replace it with @scalar_rule x / y (one(x)/y, -((x / y) / y)) or something similar? |
Yeah, that's the culprit: julia> z, back = rrule(/, 1f0, 2)
(0.5f0, ChainRules.var"#575#/_pullback#149"{Float32,Int64}(1.0f0, 2))
julia> back(1)
(Zero(), 0.5, -0.25f0) Your proposed change looks right to me. |
Also fixed in JuliaDiff/DiffRules.jl#46, but without a test it seems. |
+1 on removing dependency on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When performing division of a Float32 by an Int I get a Float64 gradient
@oxinabox @MikeInnes @sethaxen @DhairyaLGandhi any clue of when was this introduced?
This is causing FluxML/Flux.jl#1269 and possibly also FluxML/Flux.jl#1255
The text was updated successfully, but these errors were encountered: