onnx_graphsurgeon: toposort failed on a graph without cycle
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
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)]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided toposort.onnx model using the shown Python script, starting at the graph.toposort() entry point. Compare the reported cycle with the model's actual graph structure; done means this acyclic model sorts successfully without the cycle exception, with coverage for the regression if the project has an appropriate test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100