Typing necessary for static Python-Numpy compilers like Pythran and Cython
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
まず、現在の array-api-typing の機能を確認し、この issue の Transonic の例と比較します。融合データ型と配列の次元も含めてください。完了条件は、これらのシグネチャを現時点で表現できるかどうかを判断することです。できない場合は、不足している機能と、その将来的に考えられる方向性を定義します。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- Python
- スター
- 27
- フォーク
- 6
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
data-apis/array-api-typing のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
data-apis/array-api-typing#70 · コメント 7 件 ·
-
CI + lefthook オープン👷 CI
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
data-apis/array-api-typing#40 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/array-api-typing#30 · リアクション 3 件 ·
-
Refactor Test Suite オープン✅ tests
data-apis/array-api-typing#25 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
data-apis/array-api-typing#23 · コメント 6 件 ·
data-apis/array-api-typing の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stephrobert/dsoxlab#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
sublimehq/package_control#1780 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nwg-piotr/nwg-displays#145 ·