JuliaArrays / JuliaArrays/StaticArrayInterface.jl
Some reshapes of subarrays are strided, but `StrideIndex` fails.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Julia
- Stelle
- 14
- Fork
- 8
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
julia> ix = 2;
julia> A = rand(7, 5, 6);
julia> src = view(view(A,ix, :, :),:);
julia> ArrayInterface.StrideIndex(src)
ERROR: TypeError: in typeassert, expected Tuple{Int64}, got a value of type Nothing
Stacktrace:
[1] (ArrayInterface.StrideIndex{1, nothing, nothing})(s::Tuple{StaticInt{1}}, o::Tuple{StaticInt{1}})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:197
[2] (ArrayInterface.StrideIndex{1, nothing, nothing})(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:200
[3] ArrayInterface.StrideIndex(a::SubArray{Float64, 1, Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}}, Tuple{Base.Slice{Base.OneTo{Int64}}}, true})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:203
[4] top-level scope
@ REPL[25]:1
julia> ArrayInterface.StrideIndex(vec(view(A,ix,:,:)))
ERROR: TypeError: in typeassert, expected Tuple{Int64}, got a value of type Nothing
Stacktrace:
[1] (ArrayInterface.StrideIndex{1, nothing, nothing})(s::Tuple{StaticInt{1}}, o::Tuple{StaticInt{1}})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:197
[2] (ArrayInterface.StrideIndex{1, nothing, nothing})(a::Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:200
[3] ArrayInterface.StrideIndex(a::Base.ReshapedArray{Float64, 1, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}}, true}, Tuple{}})
@ ArrayInterface ~/.julia/dev/ArrayInterface/src/array_index.jl:203
[4] top-level scope
@ REPL[26]:1
Basically, if collapsed dims are dense with respect to one another, collapsing them presevers strided-ness.
We should also redefine dense dims as necessary to be a statement only about that dim.
julia> ArrayInterface.dense_dims(view(A,ix,:,:))
(static(false), static(false))
So that the first dim is not dense, but the second one still is w/ respect to the first.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci i due esempi Julia, quindi esamina src/array_index.jl intorno alle righe 197-203, dove StrideIndex fallisce. Segui dense_dims(view(A,ix,:,:)) e la gestione della dimensione collassata; il lavoro è completato quando entrambe le chiamate a StrideIndex funzionano e dense_dims restituisce (static(false), static(false)) come descritto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia
- Ambito
- performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100