Skip to content
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

[Feature] Add output_padding option to ConvTranspose2d #1423

Open
zcbenz opened this issue Sep 19, 2024 · 0 comments
Open

[Feature] Add output_padding option to ConvTranspose2d #1423

zcbenz opened this issue Sep 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@zcbenz
Copy link
Contributor

zcbenz commented Sep 19, 2024

Passing the same parameters to nn.ConvTranspose2d does not revert nn.Conv2d in terms of dimension shape conservation, and an output_padding option can solve it.

Reference from PyTorch's docs:

The padding argument effectively adds dilation * (kernel_size - 1) - padding amount of zero padding to both sizes of the input. This is set so that when a Conv2d and a ConvTranspose2d are initialized with same parameters, they are inverses of each other in regard to the input and output shapes. However, when stride > 1, Conv2d maps multiple input shapes to the same output shape. output_padding is provided to resolve this ambiguity by effectively increasing the calculated output shape on one side. Note that output_padding is only used to find output shape, but does not actually add zero-padding to output.

@awni awni added the enhancement New feature or request label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants