[Bug] [Relax][ONNX] Resize align_corners divides by zero for a unit output extent
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, machine-learning
Línea de trabajo
Empieza en python/tvm/topi/image/resize.py por el cálculo de coordenadas enlazado en el issue y luego lee la regla align_corners de ONNX Resize-13 para dimensiones de salida de uno. Ejecuta la reproducción proporcionada para las alturas 3 y 1; se considera terminado cuando el caso de altura 1 se compila y devuelve [[[[0, 0.5, 1]]]], mientras que el caso de control con altura 3 sigue pasando. Añade o localiza una prueba de regresión para este caso.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected behavior
Resize-13 maps the coordinate to zero when an align_corners output extent is one. Resizing this input to (1,1,1,3) should return [[[[0,0.5,1]]]].
Actual behavior
Output height 3 executes correctly; changing only height to 1 fails while building with Divide by zero. The coordinate calculation divides by output_size-1 without the unit-extent case. This differs from #20877, which concerns the tf_crop_and_resize branch.
Environment
TVM 0.28.dev0, LLVM 18.1.3, Linux x86_64; Python 3.12.3, NumPy 2.5.4, ONNX 1.22.0. Installed binary build revision is unknown. Current main was inspected statically, not rebuilt.
Steps to reproduce
import numpy as np
import onnx
import tvm
from onnx import TensorProto as T, helper as h, numpy_helper as nh
from onnx.reference import ReferenceEvaluator
from tvm import relax
from tvm.relax.frontend.onnx import from_onnx
x = np.arange(4, dtype="float32").reshape(1, 1, 2, 2)
for height in [3, 1]:
shape = [1, 1, height, 3]
model = h.make_model(h.make_graph([
h.make_node("Resize", ["x", "", "", "sizes"], ["y"], mode="linear", coordinate_transformation_mode="align_corners")],
"resize", [h.make_tensor_value_info("x", T.FLOAT, x.shape)],
[h.make_tensor_value_info("y", T.FLOAT, shape)],
[nh.from_array(np.array(shape, dtype="int64"), "sizes")]),
opset_imports=[h.make_opsetid("", 13)], ir_version=10)
onnx.checker.check_model(model, full_check=True)
expected = ReferenceEvaluator(model).run(None, {"x": x})[0]
if height == 1:
np.testing.assert_array_equal(expected, [[[[0, .5, 1]]]])
try:
mod = from_onnx(model, keep_params_in_input=False)
vm = relax.VirtualMachine(relax.build(mod, target="llvm"), tvm.cpu())
actual = vm["main"](tvm.runtime.tensor(x)).numpy()
except Exception as error:
if height != 1:
raise
assert "zero" in str(error).lower()
print("size-one failure:", type(error).__name__, str(error).splitlines()[-1])
else:
np.testing.assert_allclose(actual, expected)
assert height != 1, "Expected the reported divide-by-zero failure"
print("non-unit output control passed")
Triage
- needs-triage
- Lenguaje dominante
- Python
- Estrellas
- 13.9k
- Forks
- 4k
- Merge medio
- 8 h 6 min
- PR fusionados (30 d)
- 147
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/tvm
-
needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
[Bug] [Relax][ONNX] OneHot does not convert floating-point depth to int64Posiblemente ocupada @tandede la tomó hace 3 días. Abiertoneeds-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
[Bug][Relax] ReorderTakeAfterMatmul fails on vector dot productsPosiblemente ocupada @hiyufan la tomó hace 13 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
apache/tvm#20595 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/tvm
Issues similares
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Posiblemente ocupada @geyazheng la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
langchain-ai/langchain-aws#1469 ·
Los mantenedores suelen responder en 1 día
-
GCToggler leaves collection enabled if the body re-enables itPosiblemente ocupada @Gambit-Checkmate la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 7 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
EESSI/docs#949 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
doronz88/pymobiledevice3#2176 ·
Los mantenedores suelen responder en 1 día
-
b4b usability
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día