[Bug] [Relax][ONNX] NonMaxSuppression silently replaces a runtime output limit with zero
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 67/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- machine-learning
Línea de trabajo
Start in python/tvm/relax/frontend/onnx/onnx_frontend.py at the converter lines linked in the report, and trace how a runtime max_output_boxes_per_class Var is handled when it is absent from the initializer table. Compare the dynamic-input and initializer cases using the reproduction with scalar inputs and an explicit IoU threshold. Done means the runtime limit selects the same two rows as the constant limit, with relevant tests passing.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected behavior
A runtime max_output_boxes_per_class=2 should select the same two disjoint boxes as an initializer containing the identical value.
Actual behavior
The constant-limit control matches ORT. Making only the limit a graph input silently changes the result from two rows to no selections:
constant limit (2, 3) [[0, 0, 0], [0, 0, 1]]
runtime limit (0, 3) []
The converter substitutes zero when a limit Var is absent from the initializer table. This case uses zero-dimensional scalars and an explicit IoU threshold, unlike #19693 and #20506.
Environment
TVM 0.28.dev0, LLVM 18.1.3, Linux x86_64; Python 3.12.3, NumPy 2.5.4, ONNX 1.22.0, ORT 1.29.0. The installed binary build revision is unknown; current main was inspected statically, not rebuilt.
Steps to reproduce
Run with an LLVM-enabled TVM installation:
import numpy as np
import onnx
import onnxruntime as ort
import tvm
from onnx import TensorProto as T, helper as h, numpy_helper as nh
from tvm import relax
from tvm.relax.frontend.onnx import from_onnx
boxes = np.array([[[0, 0, 1, 1], [2, 2, 3, 3]]], dtype="float32")
scores = np.array([[[0.9, 0.8]]], dtype="float32")
limit = np.array(2, dtype="int64")
expected = np.array([[0, 0, 0], [0, 0, 1]], dtype="int64")
for dynamic in (False, True):
inputs = [h.make_tensor_value_info("boxes", T.FLOAT, [1, 2, 4]),
h.make_tensor_value_info("scores", T.FLOAT, [1, 1, 2])]
constants = [nh.from_array(np.array(0.5, dtype="float32"), "iou")]
feeds = {"boxes": boxes, "scores": scores}
if dynamic:
inputs.append(h.make_tensor_value_info("limit", T.INT64, []))
feeds["limit"] = limit
else:
constants.append(nh.from_array(limit, "limit"))
model = h.make_model(h.make_graph([
h.make_node("NonMaxSuppression", ["boxes", "scores", "limit", "iou"], ["y"])],
"nms", inputs, [h.make_tensor_value_info("y", T.INT64, [None, 3])], constants),
opset_imports=[h.make_opsetid("", 11)], ir_version=10)
onnx.checker.check_model(model, full_check=True)
options = ort.SessionOptions()
options.intra_op_num_threads = options.inter_op_num_threads = 1
options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_DISABLE_ALL
source = ort.InferenceSession(model.SerializeToString(), options,
providers=["CPUExecutionProvider"]).run(None, feeds)[0]
np.testing.assert_array_equal(source, expected)
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(v) for v in feeds.values()]).numpy()
print("runtime limit" if dynamic else "constant limit", actual.shape, actual.tolist())
if not dynamic:
np.testing.assert_array_equal(actual, expected)
Triage
- needs-triage
- Lenguaje dominante
- Python
- Estrellas
- 13.9k
- Forks
- 4k
- Merge medio
- 7 h 59 min
- PR fusionados (30 d)
- 159
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 2 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 12 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
-
documentation good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
MarketSquare/robotframework-browser#5479 ·
Los mantenedores suelen responder en 1 día
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
endoflife-date/endoflife.date#11561 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
OCA/l10n-brazil#5602 ·
Los mantenedores suelen responder en 1 día
-
documentation review-2.0.0
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dkuenzel/meshcore-home-gateway#106 ·
Los mantenedores suelen responder en 1 día