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

[torchlib] logcumsumexp underflows to -inf for prefixes far below the global max

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

Maintainer thường phản hồi trong vòng 3 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
64/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend, machine-learning

Hướng nghiên cứu

Start with the torchlib implementation of torch.logcumsumexp and its aten_logcumsumexp decomposition, then review the changes referenced by #904 and #327. Use the provided Python reproduction to compare the exported model with PyTorch eager. The work is done when prefixes far below the global maximum remain finite and match the eager result.

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

Mô tả

bug module: torchlib

torch.logcumsumexp exported through torchlib returns -inf for any prefix whose values sit far below the maximum of the whole dimension. aten_logcumsumexp subtracts a single ReduceMax over the dim before Exp, so those early entries underflow to 0 in float32 and their log becomes -inf.

import torch

class M(torch.nn.Module):
    def forward(self, x):
        return torch.logcumsumexp(x, 0)

x = torch.tensor([-200., -100., 100.])
p = torch.onnx.export(M(), (x,), dynamo=True)
print(p(x)[0])
print(M()(x))

Observed: tensor([-inf, -inf, 100.])
Expected (PyTorch eager): tensor([-200., -100., 100.])

This hits running log-probability sums (CTC or HMM style) where early steps are very negative. #904 closed #327 with the subtract-max trick and no Scan; this input needs a per-prefix max, which one global max cannot provide.

onnxscript 0.7.2 (the function is identical on main), torch 2.14.1+cpu, onnxruntime 1.31.0, Python 3.13, Windows 11.

Ngôn ngữ chính
Python
Star
456
Fork
148
Merge trung bình
3 ngày 13 giờ
Pull request đã merge (30 ngày)
21

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

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 microsoft/onnxscript

Tất cả issue của microsoft/onnxscript

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.