Skip to content

onnx_graphsurgeon: toposort failed on a graph without cycle #4086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xhdhr10000 opened this issue Aug 17, 2024 · 2 comments
Open

onnx_graphsurgeon: toposort failed on a graph without cycle #4086

xhdhr10000 opened this issue Aug 17, 2024 · 2 comments
Labels
Module:GraphSurgeon Issues with ONNX-Graphsurgeon triaged Issue has been triaged by maintainers

Comments

@xhdhr10000
Copy link

Description

toposort onnx
Run toposort on this simple onnx got an error:
OnnxGraphSurgeonException: Cycle detected in graph! Are there tensors with duplicate names in the graph?

Environment

onnx==1.16.2
onnx_graphsurgeon==0.5.2

Operating System:
Ubuntu 20.04

Python Version (if applicable):
python==3.8.10

Relevant Files

Model link:
toposort.onnx.zip

Steps To Reproduce

Commands or scripts:

import onnx
import onnx_graphsurgeon as gs

graph = gs.import_onnx(onnx.load('./toposort.onnx'))
graph.toposort()
# `OnnxGraphSurgeonException: Cycle detected in graph! Are there tensors with duplicate names in the graph?`

Have you tried the latest release?:
Yes

Can this model run on other frameworks? For example run ONNX model with ONNXRuntime (polygraphy run <model.onnx> --onnxrt):
Yes

import onnx
import onnxruntime as ort

model = onnx.load('./toposort.onnx')
sess = ort.InferenceSession(model.SerializeToString())
sess.run(['mul_0_output'], {'input': np.array(3., dtype=np.float32)})
# Out: [array(-9., dtype=float32)]
@lix19937
Copy link

I use trtexec, polygraphy, onnx-graphsurgeon, all are passed. You can follow my onnx-graphsurgeon version

onnx                      1.15.0
onnx-graphsurgeon         0.3.21
onnx-simplifier           0.4.36
onnxruntime               1.17.1

@moraxu moraxu added triaged Issue has been triaged by maintainers Module:GraphSurgeon Issues with ONNX-Graphsurgeon labels Aug 30, 2024
@srasmussenvl
Copy link

I ran in to this issue as well.
The fix proposed in #4087 worked.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module:GraphSurgeon Issues with ONNX-Graphsurgeon triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

4 participants