tensorflow-onnx
tensorflow-onnx copied to clipboard
How to remove auto added transpose op, and change the axis of split op?
Ask a Question
Question
I converted a pb model to onnx. It went smoothly and successfully. But it auto added some transpose op before and after every split op to my graph. I want to remove these transpose ops. What should I do?
Further information
The pb is NHWC format, 'split' op axis is 3. After converting to onnx, the split axis is still 3, but 'transpose' op is added before the 'split' op so that the data sent to split node is still NHWC. after 'split' op, it auto added another 'transpose' op to convert the format back to NCHW.
I want to remove these transpose ops. and let the 'split' axis directly convert from 3(in pb) to 1(in onnx).
Following is the graph of original pb(left) and my converted onnx(right side).

- Is this issue related to a specific model?
Model name: yolov8
Model opset: default
Looking forward to your reply. Thanks a lot.
Please refer to this parameter for a retry. And here is more details about the background.