You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #8504 (comment), I forced method specialization by adding parameters. However, hydra-like, this has caused a new problem: suddenly, the method is no longer being adequately specialized on its splatted inputs.
module AVDebug
type View{T,N,P<:AbstractArray,I<:(RangeIndex...)} <:AbstractArray{T,N}
parent::P
indexes::I
dims::NTuple{N,Int}end
stagedfunction subview{T,NP}(A::AbstractArray{T,NP}, I::RangeIndex...)
# stagedfunction subview(A::AbstractArray, I::RangeIndex...)# T = eltype(A)@show I
N =length(I)
sizeexprs = [:(length(I[$k])) for k =1:length(I)]
It =ntuple(length(I), i->UnitRange{Int})
Iexprs = [I[k] <:Real? (:(I[$k]:I[$k])) : (:(I[$k])) for k =1:length(I)]
dims = :(tuple($(sizeexprs...)))
Iext = :(tuple($(Iexprs...)))
:(View{$T,$N,$A,$It}(A, $Iext, $dims))
endend
Test file:
import AVDebug
A =reshape(float64(1:300), 5, 5, 3, 4)
S = AVDebug.subview(A, 1:2, 1:2, 1:2, 1:2)
@showtypeof(S)
S = AVDebug.subview(A, 1:2, 1:2, 1:2, 2)
@showtypeof(S)
S = AVDebug.subview(A, 1:2, 1:2, 2, 1:2)
@showtypeof(S)
Output:
julia> include("AVtest.jl")
I = (UnitRange{Int64},UnitRange{Int64},UnitRange{Int64},UnitRange{Int64})
typeof(S) = View{Float64,4,Array{Float64,4},(UnitRange{Int64},UnitRange{Int64},UnitRange{Int64},UnitRange{Int64})}
I = (UnitRange{Int64},UnitRange{Int64},UnitRange{Int64},Int64)
typeof(S) = View{Float64,4,Array{Float64,4},(UnitRange{Int64},UnitRange{Int64},UnitRange{Int64},UnitRange{Int64})}
ERROR: step cannot be zero
in call at ./range.jl:42
in - at operators.jl:327
in colon at range.jl:75
in anonymous at no file
in include at ./boot.jl:242
in include_from_node1 at ./loading.jl:128
while loading /tmp/AVtest.jl, in expression starting on line 8
You can see it never gets into the body of the function.
If I switch to the other function signature (see the commented-out lines), then this test passes (but of course then it starts failing #8504).
The text was updated successfully, but these errors were encountered:
In #8504 (comment), I forced method specialization by adding parameters. However, hydra-like, this has caused a new problem: suddenly, the method is no longer being adequately specialized on its splatted inputs.
Test file:
Output:
You can see it never gets into the body of the function.
If I switch to the other function signature (see the commented-out lines), then this test passes (but of course then it starts failing #8504).
The text was updated successfully, but these errors were encountered: