-
Notifications
You must be signed in to change notification settings - Fork 140
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
Type inference problem with binary operators on Julia master #75
Comments
Some warntype stuff shows it as well: Good with julia> @code_warntype *(Array(ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}}),1.0)
Variables:
A::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0}
B::Float64
Body:
begin # abstractarraymath.jl, line 55:
return A::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0} .* B::Float64::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0}
end::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0} Bad with julia> @code_warntype /(Array(ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}}),1.0)
Variables:
A::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0}
B::Float64
Body:
begin # abstractarraymath.jl, line 57:
return A::Array{ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},0} ./ B::Float64::Array{ForwardDiff.GradientNumber{N,T,C},0}
end::Array{ForwardDiff.GradientNumber{N,T,C},0} |
Doing GenSym(4) = x::ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}} ./ y::Float64::ForwardDiff.GradientNumber{N,T,C} |
Seems to be a regression in type inference? |
Tracked at JuliaLang/julia#14294 |
Very nice detective work, thanks! |
Confirmed fixed on master julia> Base.return_types(*, (ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},Float64))
1-element Array{Any,1}:
ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}} |
There was no regression test added upstream, could we put one here? |
I don't have a small repo right now. |
It seems there was a regression on Julia master for this, could someone else verify? julia> Base.return_types(*, (ForwardDiff.GradientNumber{2,Float64,Tuple{Float64,Float64}},Float64))
1-element Array{Any,1}:
ForwardDiff.GradientNumber{N,T,C}
julia> versioninfo()
Julia Version 0.5.0-dev+3977
Commit 957f1d1 (2016-05-08 00:28 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin15.4.0)
CPU: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell) |
Just a heads up that something is broken in type inference when using Julia master.
Using this simple function:
gives on 0.4.1 the normal:
However, on 0.5 this gives:
It seems that the division
x/b
cause julia to lose the type inference for the array.The text was updated successfully, but these errors were encountered: