Skip to content

Use ceilMode from pytorch MaxPool in shlo to get correct output shape #4167

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brataTT
Copy link

@brataTT brataTT commented Apr 28, 2025

Pytorch passes an argument ceilMode into MaxPool op.
Currently, torch to stablehlo conversion does not use it to determine stablehlo output shape.

This change intends to use the same logic as torch to use ceilMode when calculating output shape.
During conversion, we make up the size difference using padding.

Changes:

  • Use ceilMode param the way torch uses it.
  • Added tests for both floor and ceil cases.

@brataTT
Copy link
Author

brataTT commented Apr 28, 2025

@qingyunqu
from recent changes, I think you'd be the person to ask for reviews
lmk if anyone else would be more appropriate

@penguin-wwy
Copy link
Collaborator

@brataTT
Due to upstream issues with stablehlo #4152 (comment), the CI tests for stablehlo are currently disabled. Unless there are special circumstances, we hope that PRs related to stablehlo can wait until the CI is re-enabled before being merged.

@brataTT
Copy link
Author

brataTT commented Apr 29, 2025

@penguin-wwy
Thank you for the info.
No special circumstances here.
And definitely want to verify the change before merging.

Please let me know if you spot any improvements I can make to the change while we wait for CI to be re-enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants