Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#3,124 3 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
64/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
456
Forks
148
Merge medio
3 d 13 h
PR fusionados (30 d)
21

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/onnxscript

Todos los issues de microsoft/onnxscript

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.