Skip to content
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

Reduction over OffsetArray views triggers typeassert error #92

Closed
yha opened this issue Dec 29, 2019 · 1 comment · Fixed by #108
Closed

Reduction over OffsetArray views triggers typeassert error #92

yha opened this issue Dec 29, 2019 · 1 comment · Fixed by #108

Comments

@yha
Copy link
Contributor

yha commented Dec 29, 2019

On OffsetArrays master, Julia 1.3.0,

julia> sum(view(OffsetArray(rand(3,3,3), 0, 0, 0), :, :, 1:2), dims=(2,3))

ERROR: TypeError: in typeassert, expected Tuple{Base.IdentityUnitRange{UnitRange{Int64}},Base.IdentityUnitRange{UnitRange{Int64}},Base.OneTo{Int64}}, got Tuple{Base.IdentityUnitRange{UnitRange{Int64}},UnitRange{Int64},Base.OneTo{Int64}}
Stacktrace:
 [1] reduced_indices(::Tuple{Base.IdentityUnitRange{UnitRange{Int64}},Base.IdentityUnitRange{UnitRange{Int64}},Base.OneTo{Int64}}, ::Tuple{Int64,Int64}) at .\reducedim.jl:57
 [2] reduced_indices at .\reducedim.jl:15 [inlined]
 [3] reducedim_initarray(::SubArray{Float64,3,OffsetArray{Float64,3,Array{Float64,3}},Tuple{Base.Slice{Base.IdentityUnitRange{UnitRange{Int64}}},Base.Slice{Base.IdentityUnitRange{UnitRange{Int64}}},UnitRange{Int64}},true}, ::Tuple{Int64,Int64}, ::Float64, ::Type{Float64}) at .\reducedim.jl:92
 [4] reducedim_initarray at .\reducedim.jl:93 [inlined]
 [5] reducedim_init at .\reducedim.jl:172 [inlined]
 [6] _mapreduce_dim at .\reducedim.jl:317 [inlined]
 [7] #mapreduce#584 at .\reducedim.jl:307 [inlined]
 [8] #mapreduce at .\none:0 [inlined]
 [9] _sum at .\reducedim.jl:679 [inlined]
@yha yha changed the title Reduction over OffsetArray views trigger typeassert error Reduction over OffsetArray views triggers typeassert error Dec 29, 2019
timholy added a commit to JuliaLang/julia that referenced this issue Feb 15, 2020
The `reduced_indices` and `reduced_indices0` methods sometimes assert
that the return axes type is the same as the input.
Consequently, the implementation of `reduced_index` had better
return a range of the same type as the input.

This corrects the error in
JuliaArrays/OffsetArrays.jl#92.
I'll put a workaround in OffsetArrays.jl too.
@timholy
Copy link
Member

timholy commented Feb 15, 2020

Fixed in JuliaLang/julia#34770. We'll need a workaround here but let's first see how the discussion progresses there.

KristofferC pushed a commit to JuliaLang/julia that referenced this issue Feb 21, 2020
The `reduced_indices` and `reduced_indices0` methods sometimes assert
that the return axes type is the same as the input.
Consequently, the implementation of `reduced_index` had better
return a range of the same type as the input.

This corrects the error in
JuliaArrays/OffsetArrays.jl#92.
I'll put a workaround in OffsetArrays.jl too.

(cherry picked from commit eda4131)
birm pushed a commit to birm/julia that referenced this issue Feb 22, 2020
The `reduced_indices` and `reduced_indices0` methods sometimes assert
that the return axes type is the same as the input.
Consequently, the implementation of `reduced_index` had better
return a range of the same type as the input.

This corrects the error in
JuliaArrays/OffsetArrays.jl#92.
I'll put a workaround in OffsetArrays.jl too.
timholy added a commit that referenced this issue Mar 29, 2020
timholy added a commit that referenced this issue Mar 29, 2020
KristofferC pushed a commit to JuliaLang/julia that referenced this issue Apr 11, 2020
The `reduced_indices` and `reduced_indices0` methods sometimes assert
that the return axes type is the same as the input.
Consequently, the implementation of `reduced_index` had better
return a range of the same type as the input.

This corrects the error in
JuliaArrays/OffsetArrays.jl#92.
I'll put a workaround in OffsetArrays.jl too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants