-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Fix _upsample_2d
#535
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
Fix _upsample_2d
#535
Conversation
| # Transpose weights. | ||
| weight = torch.reshape(weight, (num_groups, -1, inC, convH, convW)) | ||
| weight = weight[..., ::-1, ::-1].permute(0, 2, 1, 3, 4) | ||
| weight = torch.flip(weight, dims=[3, 4]).permute(0, 2, 1, 3, 4) |
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.
Without the fix, we got
ValueError: step must be greater than zeroThe syntax ::-1 is for TF tensors, not for torch tensors.
|
The documentation is not available anymore as the PR was closed or merged. |
|
|
||
| stride = (factor, factor) | ||
| # Determine data dimensions. | ||
| stride = [1, 1, factor, factor] |
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.
F.conv_transpose2d should have a single int or a tuple of 2 integers for stride, not 4 integers.
patrickvonplaten
left a comment
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.
Thank you!
* Fix _upsample_2d Co-authored-by: ydshieh <[email protected]>
Fix
FirUpsample2D._upsample_2dis not working, it copies the syntax from TensorFlow 😆FirUpsample2D is never used with
use_conv=True, that's why we don't catch it.