Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modelopt/onnx/trt_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ def load_onnx_model(
if intermediate_generated_files is not None:
intermediate_generated_files.append(ir_version_onnx_path)

# Ensure nodes are topologically sorted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What operation(s) make the graph nodes "un-sorted"?

graph = gs.import_onnx(onnx_model)
graph.toposort()
onnx_model = gs.export_onnx(graph)

# Check that the model is valid
onnx.checker.check_model(onnx_model)

Expand Down
Loading