RFC: assignment via integer array indexing

未关闭
#864 39 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
numpy, python, pytorch
领域
data, tooling

调研方向

从 issue 中链接的 array-api-compat 讨论开始,检查所列实现中现有的数组索引要求。定义单个整数或布尔数组索引的通用赋值语义,包括提议的 xp.put 或等效接口;多个花式索引仍不在范围内。当标准通过一份达成共识的规范解决所列的兼容性差异时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

RFC

[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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

data-apis/array-api 的其他 Issue

查看 data-apis/array-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。