tensorflow-onnx icon indicating copy to clipboard operation
tensorflow-onnx copied to clipboard

How to remove auto added transpose op, and change the axis of split op?

Open ziyeZzz opened this issue 2 years ago • 1 comments

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). image

  • Is this issue related to a specific model?
    Model name: yolov8

Model opset: default

Looking forward to your reply. Thanks a lot.

ziyeZzz avatar Apr 19 '23 09:04 ziyeZzz

Please refer to this parameter for a retry. And here is more details about the background.

fatcat-z avatar May 08 '23 03:05 fatcat-z