[tensor-shapes] Should we allow multiple splats?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
Direzione di ricerca
Start by tracing how type variable tuples, IntTuple shapes, and tuple unpack forms are represented and handled. Compare the existing tuple and IntTuple paths, then determine whether a shared representation can support multiple splats without making them diverge. Done means the design is agreed and multiple splats are supported consistently, with coverage for the examples described in the issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
One of the things I noticed when I implemented support for IntTuple[*Elements[S], N] was that the limitation on type var tuple that there can only be one splat is artificial: we define type var tuple in a way where syntactically there can only be one in scope at a time (or at least mostly; I guess you could have one in scope at each of a class and method boundary but that's pretty artificial).
As a result, all the python type checkers I've looked at define unpack forms with only one splat.
But that's a completely artificial limitation, it makes perfect sense to splat arbitrarily many tuples into a new tuple, for example if we allow tuple splats in general then this is sensible:
def f[A: tuple, B: tuple](a: A, x: int, b: B) -> tuple[*Elements[A], int, *Elements[B]]
At the moment I'm not actually trying to support Elements for normal tuple anyway, but the same pattern can happen with IntTuple for shapes (and does happen - for example a sufficiently large cross-product might do this).
To handle this we'd have to change the representation to something like an array of tagged slots that can either be normal types or splatted types.
It is possible to make this change for just IntTuple without changing tuple, which would be less invasive, although the resulting implementation would be less coherent (ideally I don't want the types diverging too much). That's the main blocker: this isn't high enough priority for me to want to change tuple right now, but I also don't want the structures to diverge.
Inspired by a question from @TimothyEDawson in https://github.com/facebook/pyrefly/discussions/4807
- Lingua principale
- Rust
- Stelle
- 7.2k
- Fork
- 578
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 facebook/pyrefly
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
Handle editable installs with .pth filesForse già presa @connernilsen l’ha presa oggi. Apertaconfiguration
facebook/pyrefly#5457 · 1 commento · 1 reazione · 2 assegnatari ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
-
narrowing typechecking
Difficoltà 4/5 1-2 giorni Idoneità per principianti 48/100
-
django language-server
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di facebook/pyrefly
Issue simili
-
bug priority: low ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
storytold/photocraft#10370 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:doc bug in progress needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bherbruck/solvecraft#9634 · 2 commenti · 1 reazione ·
-
inflate: total_in uses plain += on c_ulong (32-bit on Windows), panics in debug for streams > 4 GiBAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
trifectatechfoundation/zlib-rs#570 · 1 commento ·
-
bug discord-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
LanternOps/breeze#10755 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
aranya-project/aranya#803 ·