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

[Performance] Inconsistent Tensor Output with Optimizations Enabled/Disabled (Pad Fusion Issue) #22177

Open
vinmazz opened this issue Sep 23, 2024 · 2 comments · May be fixed by #23190
Open
Labels
performance issues related to performance regressions stale issues that have not been addressed in a while; categorized by a bot

Comments

@vinmazz
Copy link

vinmazz commented Sep 23, 2024

Describe the issue

The tensor output results of the same ONNX model with the same inputs vary depending on whether optimizations are enabled or disabled. The issue specifically involves the Pad Fusion optimizer, particularly in cases where there is a pad layer followed by an average pool layer.

To reproduce

  1. Load the ONNX model with optimizations enabled.
  2. Perform inference with a specific set of inputs.
  3. Load the same ONNX model with optimizations disabled.
  4. Perform inference with the same set of inputs.
  5. Compare the tensor output results.

Urgency

No response

Platform

Windows

OS Version

10.0.19045

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.19.2

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Model File

Pad_AveragePool_ONNX_model.zip

Is this a quantized model?

No

@vinmazz vinmazz added the performance issues related to performance regressions label Sep 23, 2024
Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Oct 23, 2024
@mayeut
Copy link
Contributor

mayeut commented Dec 18, 2024

Seems to have been introduced by #21556

mayeut added a commit to mayeut/onnxruntime that referenced this issue Dec 24, 2024
Fusing Pad & AveragePool requires AveragePool to use `count_include_pad=1`.
If the AveragePool already set some padding and `count_include_pad=0`, fusion can't happen.

This PR adds a condition to perform fusion depending on those attributes. If fusion occurs,  `count_include_pad` is always set to `1`.

Fix microsoft#22177
@mayeut mayeut linked a pull request Dec 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance issues related to performance regressions stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants