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

Generalize the PyTorch avg_pool linalg lowering algorithm for the case where count_include_pad = false. #4010

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ivangarcia44
Copy link

@ivangarcia44 ivangarcia44 commented Feb 7, 2025

Currently the avg_pool2d PyTorch operation supports the cases where count_include_pad is true and false, but the avg_pool1d and avg_pool3d only the true case is supported (which is simpler).

The count_include_pad = false support for avg_pool2d was added by @AmosLewis in this change (reviewed by @rsuderman and @nirvedhmeshram) : #3235

In this change I generalized the logic added above. I also did some refactoring to the original code to reduce the size of the functions and to avoid redundancy when possible.

@sahas3 @dixinzhou @rafaelubal

@sahas3 sahas3 requested review from rsuderman and AmosLewis February 8, 2025 02:33
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
lib/Conversion/TorchToLinalg/Pooling.cpp Outdated Show resolved Hide resolved
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