Handling materialization of lazy arrays
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず Array.device と Array.to_device の Array API 定義を読み、続いて materialization に関する議論とリンクされた issue #689 を確認します。sparse、Dask、JAX について示されている要件を、提案されている 2 つの API アプローチと比較します。必要な API 設計についてコミュニティの決定に到達し、それを文書化できれば完了です。実装ファイルやテストは指定されていません。
索引モデルが issue の本文から書いたものです。
説明
Background
Some colleagues and me were doing some work on sparse when we stumbled onto a limitation of the current Array API Standard, and @kgryte was kind enough to point out that it might have some wider implications than just sparse, so it would be prudent to discuss it with other relevant parties within the community before settling on an API design to avoid fragmentation.
Problem Statement
There are two notable things missing from the Array API standard today, which sparse, and potentially Dask, JAX and other relevant libraries might also need.
- Support for storage formats.
- In Dask, this might be the array metadata, such as the type of the inner array.
- In
sparse, this would be the format of the sparse array (CRS,CCS,COO, ...).
- Support for lazy arrays/materialization
sparse/JAX might use this to build up kernels before running a computation- Dask might use this for un-computed arrays stored as a task graph.
Potential solutions
Overload the Array.device attribute and the Array.to_device method.
One option is to overload the objects returned/accepted by these to contain a device + storage object. Something like the following:
class Storage:
@property
def device(self) -> Device:
...
@property
def format(self) -> Format:
...
def __eq__(self, other: "Storage") -> bool:
""" Compatible if combined? """
def __ne__(self, other: "Storage") -> bool:
""" Incompatible if combined? """
class Array:
@property
def device(self) -> Storage:
...
def to_device(self, device: Storage, ...) -> "Array":
...
To materialize an array, one could use to_device(default_device()) (possible after #689 is merged).
Advantages
As far as I can see, it's compatible with how the Array API standard works today.
Disadvantages
We're mixing the concepts of an execution context and storage format, and in particular overloading operators in a rather weird way.
Introduce an Array.format attribute and Array.to_format method.
Advantages
We can get the API right, maybe even introduce xp.can_mix_formats(...).
Disadvantages
Would need to wait till the 2024 revision of the standard at least.
Tagging potentially interested parties:
- @jakirkham @tomwhite for Dask
- @jakevdp for JAX
- Please add anyone I missed
- 主要言語
- Python
- スター
- 281
- フォーク
- 52
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
data-apis/array-api のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
Maintenance
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
data-apis/array-api の issue をすべて見る
似ている issue
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100