RFC: add APIs for getting elements via a list of indices (i.e., `take`, `take_along_axis`, etc)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
提案と、リンクされている sorting_functions.md および set_functions.md の仕様セクションから始め、参照されている NumPy、CuPy、Dask、MXNet、Torch、TensorFlow の API を比較します。take/put ファミリーのスコープとセマンティクスについてプロジェクトの合意が得られ、関連する Array API 仕様が更新された時点で作業は完了です。
索引モデルが issue の本文から書いたものです。
説明
Proposal
Add APIs for getting and setting elements via a list of indices.
Motivation
Currently, the array API specification does not provide a direct means of extracting and setting a list of elements along an axis. Such operations are relatively common in NumPy usage either via "fancy indexing" or via explicit take and put APIs.
Two main arguments come to mind for supporting at least basic take and put APIs:
-
Indexing does not currently support providing a list of indices to index into an array. The principal reason for not supporting fancy indexing stems from dynamic shapes and compatibility with accelerator libraries. However, use of fancy indexing is relatively common in NumPy and similar libraries where dynamically extracting rows/cols/values is possible and can be readily implemented.
-
Currently, the output of a subset of APIs currently included in the standard cannot be readily consumed without manual workarounds if a specification-conforming library implemented only the APIs in the standard. For example,
Background
The following table summarizes library implementations of such APIs:
| op | NumPy | CuPy | Dask | MXNet | Torch | TensorFlow |
|---|---|---|---|---|---|---|
| extracting elements along axis | take |
take |
take |
take |
take/gather |
gather/numpy.take |
| setting elements along axis | put |
put |
-- | -- | scatter |
scatter_nd/tensor_scatter_nd_update |
| extracting elements over matching 1d slices | take_along_axis |
take_along_axis |
-- | -- | -- | gather_nd/numpy.take_alongaxis |
| setting elements over matching 1d slices | put_along_axis |
-- | -- | -- | -- | -- |
While most libraries implement some form of take, fewer implement other complementary APIs.
- 主要言語
- Python
- スター
- 281
- フォーク
- 52
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
data-apis/array-api のほかの issue
-
bug Maintenance Narrative Content
難易度 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
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openvinotoolkit/openvino_notebooks#3665 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
benchmark-gap
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信