apache / apache/tvm

[Bug] [ONNX][FRONTEND] - Loop and NonMaximalSupression operators missing

Open
#17,767 1 comment 1 reaction 0 assignees View on GitHub
needs-triage type: bug
Dominant language
Python
Stars
13.7k
Forks
4k
Avg merge
2d 19h
Merged PRs (30d)
111

Description

When converting ONNX models that contain dynamic control flow (e.g., the Loop operator) or post-processing operations such as NonMaxSuppression using TVM's Relax ONNX frontend, the conversion fails with the following error:

tvm.error.OpNotImplemented: The following operators are not supported for frontend ONNX: Loop, NonMaxSuppression

This issue prevents conversion of models such as YOLOv3/YOLOv5 that include these operators. It appears that the Relax ONNX frontend does not currently implement these operators.

Steps to Reproduce:
Export a YOLO model (or any model containing Loop and/or NonMaxSuppression) to ONNX.
Load the ONNX model using TVM's Relax ONNX frontend:

````
import onnx
import tvm.relax as relax

onnx_model = onnx.load("path/to/model.onnx")
shape_dict = {"input": (1, 3, 640, 640)}
mod, params = relax.frontend.from_onnx(onnx_model, shape_dict)
````

Expected Behavior: Either these operators should be supported by the ONNX Relax frontend, or the frontend should provide a clear message or workaround (such as lowering them to supported operators) so that users can convert their models.

Environment:

TVM Version: 19
Model: YOLO model onnx - https://github.com/onnx/models/tree/main/validated/vision/object_detection_segmentation/yolov3

Additional Info: The issue appears when converting models that rely on dynamic control flow or include post-processing operators like Loop and NonMaxSuppression.

Additional Context: This issue was encountered while attempting to convert a YOLO model to TVM Relax IR. Any guidance or **workarounds** on handling these operators would be greatly appreciated.

cc @KJlaccHoeUM9l

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the `relax.frontend.from_onnx` entry point and reproduce the failure using a YOLOv3/YOLOv5 model or a model containing `Loop` and `NonMaxSuppression`. Done means these operators convert successfully, or the frontend provides a clear supported workaround or diagnostic for them.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.