RFC: assignment via integer array indexing
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
调研方向
从 issue 中链接的 array-api-compat 讨论开始,检查所列实现中现有的数组索引要求。定义单个整数或布尔数组索引的通用赋值语义,包括提议的 xp.put 或等效接口;多个花式索引仍不在范围内。当标准通过一份达成共识的规范解决所列的兼容性差异时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
[EDIT] this issue is about the lack of xp.put or equivalent __setitem_ semantics for integar array indices. Read comments below.
[original post]
The current situation when an index is an array of ints or bools is very messy:
- numpy blindly passes every unexpected object it finds to np.asarray, which makes it accept np.ndarray, lists, tuples, but also memoryviews and anything with an
__array__interface - Sparse accepts lists, tuples, or numpy arrays; other sparse arrays don't work
- PyTorch won't accept numpy arrays of unsigned integers
- PyTorch won't accept PyTorch arrays of integers with dtype other than the native int
- JAX won't accept lists or tuples
- dask won't accept tuples
I think the array API standard should define a reasonable common surface.
xref https://github.com/data-apis/array-api-compat/pull/205#discussion_r1861288136
NOTE: the much more complicated case of multiple fancy indices, e.g. a[[0, 1], [1, 2]] is out of scope for this issue.
- 主要语言
- Python
- 星标
- 281
- 派生
- 52
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
data-apis/array-api 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 5/5 一周以上 新手友好度 35/100
-
Maintenance
-
难度 5/5 一周以上 新手友好度 25/100
查看 data-apis/array-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 74/100