You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to split ONNX graphs into 2 distinct models each using the extract_model utility. While the code runs through without any errors, an inspection of the resulting graphs via Netron shows an interesting result. The following examples are from the separation of a converted sklearn DecisionTree model.
This is the section of the full model where the "cut" should be happening - in front of the Reshape node.
I then define two extract_model instances, with the first using the full model input as input name, and the outputs of the Gather node as outputs (which serve as the input for the aforementioned Reshape node). The second instance uses the inputs of the Reshape node as input names, and the overall, full model output as output. Here are the results.
The second model is somewhat successfully extracted:
The first half however, breaks down the entirety of the tree model preceeding the "cut" and results in this:
The output of the Gather node seems to be completely lost (as of course the entirety of all operations preceeding the cut).
The code lines used are: onnx.utils.extract_model(fullmodel_path, output_path0, [overall_input_name], fullmodel.graph.node[i-1].output) onnx.utils.extract_model(fullmodel_path, output_path1, nn.input, [overall_output_name])
with both lines running in a for loop iterating through the full model to get all possible partitions into 2 sub-models, defined as: for i, nn in enumerate(fullmodel.graph.node)
Is there a mistake on my end when defining the problem, or is there a bug within the utility itself?
Thank you for your time!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to split ONNX graphs into 2 distinct models each using the extract_model utility. While the code runs through without any errors, an inspection of the resulting graphs via Netron shows an interesting result. The following examples are from the separation of a converted sklearn DecisionTree model.
This is the section of the full model where the "cut" should be happening - in front of the Reshape node.
I then define two extract_model instances, with the first using the full model input as input name, and the outputs of the Gather node as outputs (which serve as the input for the aforementioned Reshape node). The second instance uses the inputs of the Reshape node as input names, and the overall, full model output as output. Here are the results.
The second model is somewhat successfully extracted:

The first half however, breaks down the entirety of the tree model preceeding the "cut" and results in this:

The output of the Gather node seems to be completely lost (as of course the entirety of all operations preceeding the cut).
The code lines used are:
onnx.utils.extract_model(fullmodel_path, output_path0, [overall_input_name], fullmodel.graph.node[i-1].output)
onnx.utils.extract_model(fullmodel_path, output_path1, nn.input, [overall_output_name])
with both lines running in a for loop iterating through the full model to get all possible partitions into 2 sub-models, defined as:
for i, nn in enumerate(fullmodel.graph.node)
Is there a mistake on my end when defining the problem, or is there a bug within the utility itself?
Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions