Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`searchsorted` needs to broadcast batch shapes

Đang mở
#1,014 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
33
Fork
33
Merge trung bình
1 giờ 16 phút
Pull request đã merge (30 ngày)
32

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của data-apis/array-api-extra

Tất cả issue của data-apis/array-api-extra

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.