[Relax][ONNX] Accept 1-D scalar inputs in NonMaxSuppression#19843
[Relax][ONNX] Accept 1-D scalar inputs in NonMaxSuppression#19843guan404ming wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the ONNX frontend in TVM Relax to use .numpy().item() instead of .numpy() when converting 1-D single-element constants to Python scalars, ensuring compatibility with NumPy 2.x. A test case has also been added to verify this behavior. The review feedback points out that iou_threshold is missing a relax.Var handling path in both _impl_v10 and _impl_v1 implementations, which could cause it to be silently ignored and overridden to its default value when provided as a variable.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
79d747a to
ddc4246
Compare
Related Issue
closes #19693
Why
NumPy 2.x raises TypeError on int(np.array([3])), so importing an ONNX NonMaxSuppression whose scalar params are 1-D single-element tensors (shape[1], common from exporters) crashed.
How