Skip to content

[QNN EP] MaxPool input rank-3 auto pad bug fix #24827

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

Merged

Conversation

quic-ashwshan
Copy link
Contributor

  • Previously, padding for rank-3 MaxPool was only computed for auto_pad="NOTSET", using the final output shape.
  • Identified a broader issue during auto_pad="VALID" implementation: padding must be derived from the recalculated output shape.
  • Added unit tests to cover all use cases of auto_pad.
  • Enabled the failing unit test in the cpu pool test

Description

This PR fixes an issue in the padding calculation logic for rank-3 MaxPool operations when using auto_pad. The bug stemmed from using the final output shape (rank-3) to compute padding, rather than the correct intermediate shape (rank-4) that MaxPool actually operates on. The logic has been updated to use the reshaped rank-4 output for accurate padding computation. Unit tests have been added to validate behavior across all auto_pad modes.

Motivation and Context

While implementing support for auto_pad="VALID" in MaxPool, we discovered that the padding for MaxPool rank-3 was being calculated using the final output shape, which is rank-3. However, MaxPool internally operates on a reshaped rank-4 tensor (via pre- and post-processing reshapes). As a result, the padding logic was misaligned with the actual shape used during pooling, leading to test failures.

- Previously, padding for rank-3 MaxPool was only computed for
  auto_pad="NOTSET", using the final output shape.
- Identified a broader issue during auto_pad="VALID" implementation:
  padding must be derived from the recalculated output shape.
- Added unit tests to cover all use cases of auto_pad.
@HectorSVC HectorSVC added the ep:QNN issues related to QNN exeution provider label May 21, 2025
@HectorSVC
Copy link
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC HectorSVC merged commit 577eac9 into microsoft:main May 21, 2025
82 checks passed
@qti-yuduo qti-yuduo deleted the dev/quic-ashwshan/maxpool_rank3_pad_fix branch May 21, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:QNN issues related to QNN exeution provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants