Known issues with VNT, part 3 -- multiindex-upon-multiindex can give wrong keys with ArrayLikeBlocks
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 28/100
Direzione di ricerca
Riproduci l’esempio con templated_setindex!!, @varname(x[2:4][1:2]) e un ArrayLikeBlock, quindi esamina come vengono utilizzati gli indici di ArrayLikeBlock e le posizioni di PartialArray per formare le chiavi. Il lavoro è completato quando keys(vnt) segnala le posizioni effettivamente memorizzate, come x[2] e x[3], invece di x[1:2], senza alterare i dati posizionati correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
using DynamicPPL
using DynamicPPL: templated_setindex!!
struct A end
Base.size(::A) = (2,)
vnt = VarNamedTuple()
vnt = templated_setindex!!(vnt, A(), @varname(x[2:4][1:2]), randn(4))
keys(vnt)
# 1-element Vector{VarName}:
# x[1:2]
Here, we are setting indices 2 and 3 of the parent array x. However, keys(vnt) reports [1:2].
The reason for this is because the index in the key is obtained from the ArrayLikeBlock that is used to store the sized thing. In turn, the ArrayLikeBlock's indices are obtained from the indices that were used to initially set it inside the array, which were 1:2 -- it has no way of knowing that there was a 2:4 that came before it.
If this was x[1:N][P:Q] this would actually work perfectly fine for any N,P,Q but this issue is a worst-case scenario where the first set of multiindices don't begin at 1.
The fact that the stored indices are wrong can also lead to weird results when merging two VNTs with data that is mislabelled like this.
Note that the ALBs are still stored in the correct position in the PartialArray (indices 2 and 3 are the actual thing that we stored -- the other two indices are junk data generated via undef, but are masked so will never be seen). It's just the keys that are weird.
julia> vnt.data.x.data
4-element Vector{DynamicPPL.VarNamedTuples.ArrayLikeBlock{A, Tuple{UnitRange{Int64}}, @NamedTuple{}, Tuple{Int64}}}:
ArrayLikeBlock(A(), (4526817440:4526817488,), NamedTuple(), (4526817536,))
ArrayLikeBlock(A(), (1:2,), NamedTuple(), (2,))
ArrayLikeBlock(A(), (1:2,), NamedTuple(), (2,))
ArrayLikeBlock(A(), (0:0,), NamedTuple(), (131330,))
(This is good: it means that if we store an array instead of an ALB, the keys will be correctly picked up, because they are in the right positions.)
vnt = VarNamedTuple()
vnt = templated_setindex!!(vnt, randn(2), @varname(x[2:4][1:2]), randn(4))
keys(vnt)
# 2-element Vector{VarName}:
# x[2]
# x[3]
I personally think this is niche enough that we shouldn't need to care about it.
- Lingua principale
- Julia
- Stelle
- 291
- Fork
- 43
- Merge medio
- 1g 23h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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.
Altre issue di TuringLang/DynamicPPL.jl
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
TuringLang/DynamicPPL.jl#1499 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
TuringLang/DynamicPPL.jl#1480 ·
I maintainer di solito rispondono entro 2 giorni
-
Separate model-evaluation inputs from outputsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertadata-structures enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
TuringLang/DynamicPPL.jl#1469 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
TuringLang/DynamicPPL.jl#1466 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
documentation
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
TuringLang/DynamicPPL.jl#1390 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di TuringLang/DynamicPPL.jl
Issue simili
-
Release CorleoneInverse as 0.1.1Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
SciML/Corleone.jl#200 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaAI/MLJTransforms.jl#120 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
exercism/julia#1205 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
SciML/OrdinaryDiffEq.jl#5175 ·
I maintainer di solito rispondono entro 1 giorno