Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Two small JAX-related cleanups

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Read src/array_api_extra/_lib/_helpers.py around the JAX capabilities() workaround and src/array_api_extra/_agnostic/_set.py around nunique. The issue leaves removal of the workaround contingent on deciding whether to support JAX versions below 0.6.0, so first check project policy and tests. Done means the comments accurately describe JAX's unique_counts behavior, and any shim or minimum-version documentation reflects the project's support decision.

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

描述

1. Drop the capabilities() shim for jax < 0.6.0?

https://github.com/data-apis/array-api-extra/blob/04407df9d1f8a06f72faf1d9951c82f81f237d06/src/array_api_extra/_lib/_helpers.py#L315-L320

_helpers.capabilities forces "boolean indexing" to False for JAX. This works around jax-ml/jax#27418, which was fixed in JAX 0.6.0 (March 2025). CI pins jax >= 0.10.2, so this branch never runs there (it is marked # pragma: no cover).

The package doesn't declare a minimum JAX version, so whether to remove it is a policy question: do we still want to support JAX < 0.6.0 at runtime? If not, the branch can be deleted:

out = xp.__array_namespace_info__().capabilities()
if _compat.is_torch_namespace(xp):
    ...

Removing it would also be a good moment to document a minimum supported JAX version.

2. Inaccurate comment in nunique

https://github.com/data-apis/array-api-extra/blob/04407df9d1f8a06f72faf1d9951c82f81f237d06/src/array_api_extra/_agnostic/_set.py#L31-L35

# 3. backend does not have unique_counts; e.g. wrapped JAX

JAX does have unique_counts. It takes the O(n log n) sort-based path because capabilities()["data-dependent shapes"] is False (the output shape of unique_counts can't be known under jax.jit). Also, JAX is no longer "wrapped": jax.numpy is used directly. Suggested wording:

# 3. backend lacks data-dependent shapes, so unique_counts is unusable
#    (e.g. JAX, whose output shape can't be known under jax.jit)

The comment just below it, # xp does not have unique_counts; O(n*logn) complexity, should be updated the same way.

主要语言
Python
星标
33
派生
33
平均合并
1 小时 16 分钟
30 天内合并 PR
32

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

data-apis/array-api-extra 的其他 Issue

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

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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