Last active
April 25, 2020 06:08
-
-
Save sicongzhao/4beccdc2178c643c1f827b6cac8b8908 to your computer and use it in GitHub Desktop.
Demystify Transposed Convolutional Layer
This file contains 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
# Create a TCL layer with stride=2, padding=1 | |
transConv3 = nn.ConvTranspose2d(1, 1, 3, stride=2, padding=1, bias=False) | |
# Set kernel weights to be 1 | |
transConv3.weight.data = torch.ones(1,1,3,3) | |
# Calculate | |
transConv3(input_data) | |
# Output: | |
# tensor([[[[ 1., 3., 2.], | |
# [ 4., 10., 6.], | |
# [ 3., 7., 4.]]]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment