-
Notifications
You must be signed in to change notification settings - Fork 549
[ONNX] Add support for asymmetric padding for Onnx.AveragePool op #3923
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?
Conversation
1) * | ||
strides[dimIdx] + | ||
dilatedKernelSize - inputShape[dimIdx + 2]; | ||
totalPad = totalPad >= 0 ? totalPad : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ceilMode
used in calculating the padding when using autopad? If not, why? I think the formulas in https://onnx.ai/onnx/operators/onnx__AveragePool.html differ depending on ceilMode
.
Looks very good! I made some comments since I have been working on similar changes. However, I am not very familiar with the project itself so some of my comments may be off. In general, I would suggest to add more tests to test different cases of auto_pad and asymmetric and symmetric padding. Also please note that I am out of office until January 7th and likely won't respond during that time. Maybe others can chip in. Previously we have been discussing some changes along these lines with @zjgarvey. |
bf1b7bc
to
e688390
Compare
This commit also refactors the code for the Onnx's AveragePool and MaxPool op by creating a common utility for both the op lowerings to get the pooling op parameters. Signed-off-by: Vivek Khandelwal <vivekkhandelwal1424@gmail.com>
e688390
to
1b926a8
Compare
Hi, I have modified the implementation. Can this PR be reviewed again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Make sure if @tuukkjs 's comment is addressed before merge.
@tuukkjs Can you please review the PR? |
This commit adds support for the asymmetric padding for Onnx's AveragePool op.
This commit also extends the Torch->Linalg lowering of the pooling ops to consider asymmetric padding during the output dim computation.
Signed-off-by: Vivek Khandelwal vivekkhandelwal1424@gmail.com