Skip to content

[tmva][sofie] fix for maxpool/avgpool reading wrong pad indices for asym padding#22438

Merged
guitargeek merged 1 commit into
root-project:masterfrom
harz05:fix/sofie-pool-asymmetric-pads
May 31, 2026
Merged

[tmva][sofie] fix for maxpool/avgpool reading wrong pad indices for asym padding#22438
guitargeek merged 1 commit into
root-project:masterfrom
harz05:fix/sofie-pool-asymmetric-pads

Conversation

@harz05
Copy link
Copy Markdown
Contributor

@harz05 harz05 commented May 31, 2026

Changes:

ROperator_Pool::Generate() read the pooling-window end pads at fixed indices (1, 3, 5), assuming an interleaved [begin, end, ...] layout. SOFIE stores pads in ONNX grouped order [begin..., end...],so when padding differs across spatial axes
this swapped, e.g., the height-end pad with the width-begin pad. MaxPool/AveragePool then scanned the wrong windows and produced a wrong-shaped output,silently with no error. However all existing pool tests use zero padding, so it was never exercised; I've verifed the bug as reported in #22436.

Fix: read begins at 0, 1, 2 and ends at fDim, fDim+1, fDim+2, matching the indices shape inference already uses. Symmetric padding is unchanged, so existing tests stay as it is.

Also added a MaxPool2d_AsymPad regression test (pads=[0,1,0,1]) that fails before this change and passes after; helps in verifying the path.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #22436

@harz05 harz05 requested a review from lmoneta as a code owner May 31, 2026 10:15
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 31, 2026

Test Results

    22 files      22 suites   3d 7h 25m 2s ⏱️
 3 860 tests  3 859 ✅ 0 💤 1 ❌
76 176 runs  76 175 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 2c362ed.

♻️ This comment has been updated with latest results.

@guitargeek guitargeek self-assigned this May 31, 2026
@guitargeek guitargeek added in:SOFIE clean build Ask CI to do non-incremental build on PR bug labels May 31, 2026
@guitargeek guitargeek closed this May 31, 2026
@guitargeek guitargeek reopened this May 31, 2026
Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@guitargeek guitargeek merged commit 7ebb002 into root-project:master May 31, 2026
50 of 65 checks passed
@guitargeek
Copy link
Copy Markdown
Contributor

/backport to 6.40

@root-project-bot
Copy link
Copy Markdown

Preparing to backport PR #22438 to branch 6.40 requested by guitargeek

@root-project-bot
Copy link
Copy Markdown

This PR has been backported to branch 6.40: #22442

@harz05
Copy link
Copy Markdown
Contributor Author

harz05 commented Jun 1, 2026

thanks for the review and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug clean build Ask CI to do non-incremental build on PR in:SOFIE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tmva][sofie] MaxPool and AveragePool generates wrong code for asymmetric padding

3 participants