-
Notifications
You must be signed in to change notification settings - Fork 548
Average pooling clamped divisor should be done on all conditions where the kernel can go out of bounds #4144
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
base: main
Are you sure you want to change the base?
Average pooling clamped divisor should be done on all conditions where the kernel can go out of bounds #4144
Conversation
…e the kernel can go out of bounds.
…rnel/stride/padding elements have to be processed in reversed order relative to the spatial dimensions.
@ivangarcia44 This is not a good practice to close and open a new PR just because conflicts have arisen in the branch. Ideally, you should have addressed the conflicts and updated this PR just like other contributors do. At the very least, it creates confusion and makes it hard to follow the discussion on 2 different PR for the same changes. Also, I would expect that this PR (or the new replacement of this) is not merged until a thorough review of the patch is done. The last PR had already made some changes which should not have been done, so I expect all to be more careful this time. |
I will do the merge in this PR and close the new one. |
Hi all, updated the changes after merging the conflict with @vivekkhandelwal1 's changes. Please review when you get a chance. Thank you @vivekkhandelwal1 |
In this pull request I added various E2E tests to cover edge cases on the average pooling torch to linalg lowering algorithm. These new tests uncovered various numerical issues that were addressed in this same PR.
One of the issues is the IREE test failure found in #4079 which triggered this work.
Background:
In the most common case, the divisor for the average pooling is just the product of kernel dimensions. But with padding, and ceil mode options, some elements need to be discounted from the divisor computation. This change fixes two components of this:
Fix the condition that determines if the divisor is just the product of kernel dimensions or the clamped divisor comptutation.
Reimplement the clamped divisor computation algorithm.
The clamped divisor algorithm had various numerical issues uncovered by the new E2E tests added here. In this new version all E2E pass, the variables have more specific names, and there are comments explaining the formula.
@vivekkhandelwal1
@JianzheXiao
@AmosLewis
@rsuderman
@nirvedhmeshram)
@sahas3
@Hanumanth04
@dixinzhou
@rafaelubalmw