BUG: searchsorted: needs to broadcast batch shapes
維護者通常 1 天內回覆
評估
研究方向
Start by locating the searchsorted implementation and its tests; the issue provides a reproducer for the failing case where x has shape (2, 5) and y has shape (5,). Read how the function handles batch dimensions, then run the relevant tests with this case. Done means the batch shapes broadcast and the call succeeds with the expected indices.
由索引模型根據 Issue 內容生成。
描述
Ran into this in scipy/scipy#26324:
import numpy as np
from scipy._external import array_api_extra as xpx
rng = np.random.default_rng(2398198374572881)
shape_1d = (5,)
shape_2d = (2, 5)
x = np.sort(rng.random(shape_1d), axis=-1)
y = rng.random(shape_2d)
xpx.searchsorted(x, y) # OK
x = np.sort(rng.random(shape_2d), axis=-1)
y = rng.random(shape_1d)
xpx.searchsorted(x, y) # not OK
# ValueError: input operand has more dimensions than allowed by the axis remapping
My workaround there was to broadcast the batch shapes (e.g. batch_shape = xp.broadcast_shapes(x1.shape[:-1], x2.shape[:-1])) and reshape the arguments accordingly.
- 主要語言
- Python
- 星號
- 34
- 分支
- 35
- 平均合併
- 5 小時 49 分鐘
- 30 天內合併 PR
- 58
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
data-apis/array-api-extra 的其他 Issue
-
ENH: new function `replace`可能已有人在做 @willow-ahrens 於 5 天前認領。 未關閉enhancement new function
難度 2/5 1-3 小時 新手友好度 72/100
data-apis/array-api-extra#992 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 52/100
data-apis/array-api-extra#1078 · 2 則留言 ·
維護者通常 1 天內回覆
-
BUG: `array_api_extra.testing` relies on `assert` statements that get stripped out with `PYTHONOPTIMIZE>=1`可能已有人在做 @steppi 於 6 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 58/100
data-apis/array-api-extra#1068 ·
維護者通常 1 天內回覆
-
maintenance
難度 4/5 3-5 天 新手友好度 35/100
data-apis/array-api-extra#1058 ·
維護者通常 1 天內回覆
-
Add `spacing`?未關閉
難度 3/5 3-5 天 新手友好度 40/100
data-apis/array-api-extra#1055 ·
維護者通常 1 天內回覆
查看 data-apis/array-api-extra 的全部 Issue
相似的 Issue
-
bump patch
難度 2/5 1-3 小時 新手友好度 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 78/100
QuantConnect/Documentation#2838 ·
維護者通常 1 天內回覆
-
get_all_subclasses must deduplicate by class identity可能已有人在做 @Gambit-Checkmate 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 15 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
awslabs/route53-dynamic-dns-with-lambda#67 · 1 則留言 ·