Pytorch Conv Transpose Padding Fix#7958
Merged
masahi merged 133 commits intoapache:mainfrom May 14, 2021
Merged
Conversation
added 30 commits
March 18, 2020 19:30
# 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
|
Link to discussion: https://discuss.tvm.apache.org/t/pytorch-conv-transpose-padding-fix/9873 |
Member
|
Thanks, can we close #7912? |
Contributor
Author
|
Yes. Thanks.
…On Sat, May 1, 2021 at 3:47 PM masahi ***@***.***> wrote:
Thanks, can we close #7912 <#7912>?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7958 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASRV54QZSFXTILOBJQ72V43TLSAIPANCNFSM435V3INQ>
.
|
…anspose-padding-fix # Conflicts: # tests/python/frontend/pytorch/test_forward.py
Contributor
Author
|
@masahi How can we pass the tvm-ci/pr-merge step? Looking at the details the error comes up as:
I do not believe the changes in this PR cause this issue. |
|
I think just retriggering ci will sometimes fix the problem. |
Member
|
@Jeffrey-Sima sorry missed your last comment, yes please try rebase and retrigger ci |
…anspose-padding-fix
masahi
approved these changes
May 14, 2021
Member
|
thanks @Jeffrey-Sima |
trevor-m
pushed a commit
to trevor-m/tvm
that referenced
this pull request
Jun 17, 2021
* fix conv transpose import from TF * fix String::fromwe() to String::from() * * fixing pytorch converter to take into account the output_padding parameter 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 * * removing print statements used for debugging * * fixing typos and formatting * * fixing formatting * * fixing grammar * * formatting fixes * * updated formatting after running pylint and python_format checks Co-authored-by: Mikael Sevenier <mikael.sevenier@sima.ai>
trevor-m
pushed a commit
to neo-ai/tvm
that referenced
this pull request
Jun 17, 2021
* fix conv transpose import from TF * fix String::fromwe() to String::from() * * fixing pytorch converter to take into account the output_padding parameter 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 * * removing print statements used for debugging * * fixing typos and formatting * * fixing formatting * * fixing grammar * * formatting fixes * * updated formatting after running pylint and python_format checks Co-authored-by: Mikael Sevenier <mikael.sevenier@sima.ai>
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
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.
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.PyTorchOpConverter class is updated so that when it constructed the relay convolution op it supplied the output_padding attribute 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 into tvm.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.