What's your problem?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
首先查看描述中链接的 scipy-stubs issue,以及 efax/_src/distributions/complex_normal/complex_normal.py 中的 efax 示例。比较其中展示的 Array API 类型标注问题,并收集具有代表性的代码示例,以指导 array-api-typing 的改进和集成测试。当所需案例已清晰记录到足以指导类型标注工作时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Let's collect a bunch of code samples from array-api libraries that array-api-typing could improve. That should help give us a better idea of what is needed. They should also be useful for (integration) testing.
Problems
scipy-stubs
See https://github.com/scipy/scipy-stubs/issues/140 for all of SciPy's functions that have (at least some) support for the Array API.
Here's an example from the scipy docs
import torch
from scipy.cluster.vq import vq
code_book = torch.tensor([[1., 1., 1.],
[2., 2., 2.]])
features = torch.tensor([[1.9, 2.3, 1.7],
[1.5, 2.5, 2.2],
[0.8, 0.6, 1.7]])
code, dist = vq(features, code_book)
print(code) # tensor([1, 1, 0], dtype=torch.int32)
print(dist) # tensor([0.4359, 0.7348, 0.8307])
There is currently no good way to annotate this behavior in scipy-stubs. Currently, with scipy-stubs==1.15.3.0, code and dist are inferred as 1d numpy arrays of int and float dtypes, respectively. The reason for this is the torch.tensor.__array__ method, cuasing it to be interpreted as a numpy "array-like".
efax
By @NeilGirdhar from https://github.com/data-apis/array-api-typing/issues/22#issuecomment-2973309168
Consider practically any function in my efax library. For example, we have:
def _r_s_mu(self) -> tuple[JaxComplexArray, JaxRealArray, JaxComplexArray]:
xp = array_namespace(self)
r = -self.pseudo_precision / self.negative_precision
s = xp.reciprocal((abs_square(r) - 1.0) * self.negative_precision)
k = self.pseudo_precision / self.negative_precision
l_eta = 0.5 * self.mean_times_precision / ((abs_square(k) - 1.0) * self.negative_precision)
mu = xp.conj(l_eta) - xp.conj(self.pseudo_precision / self.negative_precision) * l_eta
return r, s, mu
This is barely type-checked. It would be nice if xp: ArrayNamespace, r, s, k, l_eta, mu: Array, etc.
- 主要语言
- Python
- 星标
- 27
- 派生
- 6
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
data-apis/array-api-typing 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
data-apis/array-api-typing#70 · 7 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
data-apis/array-api-typing#59 · 4 条评论 · 1 个 reaction ·
-
CI + lefthook 未关闭👷 CI
难度 2/5 1-3 小时 新手友好度 45/100
data-apis/array-api-typing#40 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
data-apis/array-api-typing#30 · 3 个 reaction ·
-
✅ tests
data-apis/array-api-typing#25 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
查看 data-apis/array-api-typing 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 70/100
huggingface/Repo2RLEnv#163 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
难度 2/5 1-3 小时 新手友好度 70/100
NousResearch/hermes-agent#121143 ·