Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in conv+bn fusion and addition of useless reshapes in tf2onnx==1.16.1 #2300

Open
Rikyf3 opened this issue Jan 31, 2024 · 3 comments · May be fixed by #2313
Open

Inconsistency in conv+bn fusion and addition of useless reshapes in tf2onnx==1.16.1 #2300

Rikyf3 opened this issue Jan 31, 2024 · 3 comments · May be fixed by #2313
Assignees
Labels
bug An unexpected problem or unintended behavior pending on user response Waiting for more information or validation from user

Comments

@Rikyf3
Copy link

Rikyf3 commented Jan 31, 2024

Describe the bug
When I convert a u-net architecture a Conv operator and a BN operator are not fused together and 2 Reshape operators are added which reshape to the same shape [-1, 512, 1, 1].

Urgency
none

System information

  • OS Platform and Distribution: macos 14.2.1 arm64
  • TensorFlow Version: 2.13.1
  • Python version: 3.10.13
  • ONNX version: 1.15
  • ONNXRuntime version: 1.16
  • tf2onnx version: 1.16.1 (from github)

To Reproduce
https://drive.google.com/file/d/1xzaAXWxUqXUTBVgDSiyrbjs_TSHXuhwW

by running python -m tf2onnx.convert --saved-model bg_model --output bg_model.onnx

Screenshots
from the top the first conv+bn is fused correctly, then the following is not.
Screenshot 2024-01-31 at 13 10 32
Screenshot 2024-01-31 at 13 12 21

Additional context
Every other conv+bn is fused correctly except one.

@Rikyf3 Rikyf3 added the bug An unexpected problem or unintended behavior label Jan 31, 2024
@Rikyf3
Copy link
Author

Rikyf3 commented Jan 31, 2024

I conducted a little more testing.
Downgrading to onnx==1.14 and tf2onnx==1.15.1/37820d solves the issue. With tf2onnx==1.16.0 the issue reappears, I dont know if this helps for identifying the problem.

@Rikyf3 Rikyf3 changed the title Inconsistency in conv+bn fusion and addition of useless reshapes Inconsistency in conv+bn fusion and addition of useless reshapes in tf2onnx==1.16.1 Feb 1, 2024
@Rikyf3
Copy link
Author

Rikyf3 commented Feb 23, 2024

@fatcat-z any news?

@fatcat-z
Copy link
Collaborator

This is a regression bug brought by PR #2272 . @Rikyf3 , could you please share a code snippet of this module so I can prepare a test to cover it?

@fatcat-z fatcat-z self-assigned this Mar 10, 2024
@fatcat-z fatcat-z added the pending on user response Waiting for more information or validation from user label Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior pending on user response Waiting for more information or validation from user
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants