Standardize "pinned" dtype promotions
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- documentation
Direzione di ricerca
Inizia con le specifiche collegate per setitem, gli operatori in-place, clip, nextafter e la pagina sulla dtype promotion. Confronta le regole attuali con il comportamento di promotion vincolato o fissato proposto; il lavoro è completato quando la regola generale e i riferimenti alle funzioni interessate definiscono chiaramente i casi scalari e quelli con dtype misti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
These functions:
__setitem____iadd__and other in-place operatorsclipnextafter
Have in common that the output dtype must match the dtype of the first parameter. This is unlike most other binary or ternary functions, where all parameters are free to be be promoted against each other.
Q: Are there other such functions?
Beyond this, however, these functions differ substantially in the details:
First parameter is a Python scalar
- in
__setitem__,__iadd__, andclip, the first parameter must be an array. This is an obvious necessity for__setitem__and__iadd__, because it's a method, but not forclip. - in
nextafter, the first parameter can be a Python scalarint | float. The spec is not clear on what must happen in this case; I interpret it as "the output dtype must be the dtype of x if x is an array, otherwise follow the normal dtype promotion rules and return float32 or float64 depending on the dtype of y." It could use an explicit clarification.
Second parameter is an array of different dtype
- In
__setitem__and__iadd__, if the second parameter (value) is an array it can be automatically promoted to the dtype of the first parameter (self). - In
clip, behaviour is undefined. Which to me is weird, because the result would be unambiguous in all cases whereminimumandmaximumare defined and have an output dtype matching the first parameter - for example,clip(int16, min=int8, max=int8). - In
nextafter, behaviour is also undefined, which again to me is weird because it is unambiguous in all cases where__lt__,__gt__, and__eq__are defined; in other wordsnextafter(float64, float32)is unambiguous.
Proposed changes
- Allow
clipto have the first parameter as a Python scalar, like it already happens innextafter - Allow
minandmaxparameters inclipand theyparameter innextafterto be arrays of a dtype promotable tox.dtype, like it already happens in__setitem__ - Add a section to the dtype promotion page for "pinned" or "bound" dtype promotion, defining a general rule
- Have
__setitem__,clip, andnextafterpoint to this general rule
- Lingua principale
- Python
- Stelle
- 281
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
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 data-apis/array-api
-
bug Maintenance Narrative Content
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Maintenance
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di data-apis/array-api
Issue simili
-
Broken links found in docsApertadocs pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
pydantic/pydantic-ai#8863 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
run-llama/llama_index#23278 ·
I maintainer di solito rispondono entro 2 giorni
-
documentation from-review-extraction github-actions priority: low severity:nit
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
LearningCircuit/local-deep-research#6946 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
oracle/langchain-oracle#323 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
tenstorrent/tt-metal#58057 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno