[Bug] [Relax][ONNX] NonMaxSuppression silently replaces a runtime output limit with zero
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
- 67/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
- machine-learning
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 13.9k
- Fork
- 4k
- Merge trung bình
- 8 giờ 5 phút
- Pull request đã merge (30 ngày)
- 170
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/tvm
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] [Relax][ONNX] OneHot does not convert floating-point depth to int64Có thể đã có người làm @tandede đã nhận 1 ngày trước. Đang mởneeds-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug][Relax] ReorderTakeAfterMatmul fails on vector dot productsCó thể đã có người làm @hiyufan đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/tvm#20595 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
cline/mcp-marketplace#3576 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
griptape-ai/griptape-nodes-library-elevenlabs#30 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: Release playbookĐang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
awslabs/social-messaging-agent-runtime-toolkit#140 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
subtask
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fga-eps-mds/2026.2-MeasureSoftGram-DOC#187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
NSPG13/agent-bounties#1747 ·
Maintainer thường phản hồi trong vòng 1 ngày