Open
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)]