0

I'm trying skip unnecessary Transpose operations that were added previously due to the conversion process from PyTorch to Tensorflow. Any suggestions?

The model has 2 outputs and I'm trying to remove the Transpose operations from on branch of outputs. And the Transpose operation is added during the process of converting from OpenVino to Tensorflow

enter image description here

1 Answers1

1

Was able to achieve it with ONNX, Netron, and the sclblonnx python library.

I used the python library to delete and re-route the output of the node before the Transpose. And used Netron to display the ONNX graph and know what the name of that output data is:

enter image description here

Minimized example:

import sclblonnx as so
g = so.graph_from_file('/path/to/onnx/file')
g = so.delete_node(g, "Transpose_178")
idx = -1
for i,elem in enumerate(g.node):
  if elem.name == "Softmax_179":
    idx = i

g.node[i].input[0] = '570'
so.graph_to_file(g, '/home/cw/Openvino/ERFNet/ERF_lane_so.onnx' )