Typing necessary for static Python-Numpy compilers like Pythran and Cython
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng việc xem xét các khả năng hiện tại của array-api-typing và so sánh chúng với ví dụ Transonic trong issue này, bao gồm các kiểu dữ liệu hợp nhất và số chiều của mảng. Công việc được xem là hoàn tất khi xác định được liệu các chữ ký này hiện có thể được biểu diễn hay không; nếu không, hãy xác định khả năng còn thiếu và hướng phát triển khả dĩ trong tương lai của nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
- Ngôn ngữ chính
- Python
- Star
- 27
- Fork
- 6
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của data-apis/array-api-typing
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
data-apis/array-api-typing#70 · 7 bình luận ·
-
CI + lefthook Đang mở👷 CI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
data-apis/array-api-typing#40 · 1 reaction ·
-
Test suite for backends? Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/array-api-typing#30 · 3 reaction ·
-
Refactor Test Suite Đang mở✅ tests
data-apis/array-api-typing#25 · 1 bình luận · 1 reaction · 1 người được giao ·
-
Populate various protocols Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
data-apis/array-api-typing#23 · 6 bình luận ·
Tất cả issue của data-apis/array-api-typing
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/Repo2RLEnv#163 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·