Typing necessary for static Python-Numpy compilers like Pythran and Cython
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia esaminando le funzionalità attuali di array-api-typing e confrontale con l’esempio di Transonic in questa issue, inclusi i tipi di dati fusi e le dimensioni degli array. Il lavoro è completo quando si determina se queste firme possono essere espresse ora; in caso contrario, definisci la funzionalità mancante e la sua possibile direzione futura.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Static Python-Numpy compilers like Pythran and Cython (and others) need type information.
For Transonic (a tools to use Python-Numpy compilers, see https://transonic.readthedocs.io), I had to implement a simple system to be able to give enough information in Python about the types supported by functions.
I give here an example of what is possible (more complex things are sometimes needed but this is the minimum, fused data-types and "fused" number of dimensions of the array):
import numpy as np
from transonic import Array, NDim, Type, boost
T = Type(int, np.complex128)
N = NDim(1, 3)
A = Array[T, N]
A1 = Array[np.float32, N + 1]
@boost
def compute(a: A, b: A, c: T, d: A1, e: str):
...
It would be great if array-api-typing could be good enough to be able to express such things in a quite simple way.
Note that this leads to the following possible Pythran signatures:
export compute(complex128[:, :, :], complex128[:, :, :], complex128, float32[:, :, :, :], str)
export compute(complex128[:], complex128[:], complex128, float32[:, :], str)
export compute(int[:, :, :], int[:, :, :], int, float32[:, :, :, :], str)
export compute(int[:], int[:], int, float32[:, :], str)
and Cython "signatures":
import cython
import numpy as np
cimport numpy as np
ctypedef fused __compute__Array_TypeIint_complex128I_NDimI1_3I:
np.ndarray[np.complex128_t, ndim=1]
np.ndarray[np.complex128_t, ndim=3]
np.ndarray[np.int32_t, ndim=1]
np.ndarray[np.int32_t, ndim=3]
ctypedef fused __compute__Array_float32_NDimI1_3Ip1:
np.ndarray[np.float32_t, ndim=2]
np.ndarray[np.float32_t, ndim=4]
ctypedef fused __compute__TypeIint_complex128I:
cython.int
np.complex128_t
cpdef compute(__compute__Array_TypeIint_complex128I_NDimI1_3I a, __compute__Array_TypeIint_complex128I_NDimI1_3I b, __compute__TypeIint_complex128I c, __compute__Array_float32_NDimI1_3Ip1 d, cython.str e)
Is there already enough in array-api-typing to be able to express such things? If not, would it be possible in future?
- Lingua principale
- Python
- Stelle
- 27
- Fork
- 6
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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.
Altre issue di data-apis/array-api-typing
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
data-apis/array-api-typing#70 · 7 commenti ·
-
CI + lefthook Aperta👷 CI
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
data-apis/array-api-typing#40 · 1 reazione ·
-
Test suite for backends? Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
data-apis/array-api-typing#30 · 3 reazioni ·
-
Refactor Test Suite Aperta✅ tests
data-apis/array-api-typing#25 · 1 commento · 1 reazione · 1 assegnatario ·
-
Populate various protocols Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
data-apis/array-api-typing#23 · 6 commenti ·
Tutte le issue di data-apis/array-api-typing
Issue simili
-
area: harness bug status: needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Human-Agent-Society/reef#625 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
learningequality/kolibri#15351 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Name consistency Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eellak/triplestore#65 · 1 commento ·