-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Pytorch convtranspose padding fix #7912
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
Closed
mikeseven
wants to merge
134
commits into
apache:main
from
SiMa-ai:pytorch-convtranspose-padding-fix
Closed
Pytorch convtranspose padding fix #7912
mikeseven
wants to merge
134
commits into
apache:main
from
SiMa-ai:pytorch-convtranspose-padding-fix
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # python/tvm/relay/frontend/tensorflow.py
…-conv-transpose-pad-fix
…rameter for conv transpose operations * updating pytorch converter to correctly convert conv1d to conv1d in tvm inestead of a flattened conv2d unless under circumstances of grouped convolution * updating pytorch converter to correctly convert conv1d transpose to conv1d transpose in tvm instead of a flattened conv2d transpose * added tests to cover these latest additions
…-conv-transpose-pad-fix
…-conv-transpose-pad-fix
…he#34) SYSOL-584 Pytorch Conv Transpose Padding Fix Approved-by: Alicja Kwasniewska Approved-by: Mikael Sevenier
Contributor
Author
|
updated with missing files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pytorch Conv Transpose Padding Fix
Background
torch.nn.ConvTranspose2doperator.torch.nn.ConvTranspose2doperator and thetvm.relay.nn.conv2d_transposeoperator, the output_padding parameter in
tvm.relay.nn.conv2d_transposewould always default to0 regardless of what output padding was set in
torch.nn.ConvTranspose2d.tvm/python/tvm/relay/frontend/pytorch.py, the import logic for convolution layers was missing the output_padding parameter.The Fix
tvm/relay/frontend/pytorch.py.convolutionmethod of thePyTorchOpConverterclass is updated so that when it constructed the relay convolution op it supplied theoutput_paddingattribute in the cases where it was creating convolution transpose operations.torch.nn.ConvTranspose1Doperations intotvm.relay.nn.conv2d_transpose. This was fixed so now they wereconverted into
tvm.relay.nn.conv1d_transposeoperations.torch.nn.Conv1doperations were being converted intotvm.relay.nn.conv2doperations. This was fixed so that they are now converted intotvm.relay.nn.conv1doperations. There is a slight caveat where because tvm does not support grouped 1D convolution as stated in the
description of
tvm.relay.nn.conv1d, in that case we convert the operation to 2D convolution which does havesupport for grouped convolution. After the 2D convolution, we then squeeze the output to get the correct shape and
values for a grouped 1D convolution.
Test Coverage
test_forward_conv_transposetest intvm/tests/python/frontend/pytorch/test_forward.py.