-
I am trying to create a new input and subsequent node in the ONNX graph using the onnx.helper utility. I am able to correctly create the input tensor and node and insert the node into the graph.node list object. If I visualize the model in Netron it appears exactly as I want it but when using the onnx.checker.checkmodel() function it produces the issue of 'Nodes in a graph must be topologically sorted, however input 'tensor_name' of node: name: 'node_name' OpType: Conv is not output of any previous nodes. This issue does not appear if I insert new nodes in between the model input and the original 'input' node. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @ChrisPB3, A possible solution would be inserting all of the nodes in the first place regardless any order and then use their direction relationship (a -> b) to reorder existing nodes with topological sort. |
Beta Was this translation helpful? Give feedback.
-
@ChrisPB3 You can try if https://github.com/ZhangGe6/onnx-modifier works for you. I believe it should do the topoligical sorting for you. |
Beta Was this translation helpful? Give feedback.
-
hello i have this error when i want to use my model.onnx to do some predictions Can you please help me |
Beta Was this translation helpful? Give feedback.
-
Hai @jcwchen The below image main.onnx is a portion from a large graph ,I want to place the sub.onnx in to the main.onnx(ie the name of input to the reshape is name: Add.181 after matmul is name: matmul_v2_1.tmp_0 , |
Beta Was this translation helpful? Give feedback.
Thank you for the answer. I actually managed to get to get it working. There was an issue with how the input tensor was being created but once I fixed that the topological order issue was also fixed. The node taking the input tensor was looking for a node in the network corresponding to the input tensor name and because there was no such node it produced this error.