Conv2d vs ConvTranspose2d

I have a tensor a.shape = [50,64,64]. First, I shrink the size to [20,64,64] by a Con2d layer. Then I want to reconstruct it from [20,64,64] to [50,64,64].
Is there any difference between using:
conv1 = nn.Conv2d(in_channels = 20,out_channels = 50)
conv2 = nn.ConvTranspose2d(in_channels = 20,out_channels = 50)

Hi,

The transpose or not refers to how spatial dimensions are handled, not channel dimensions.
If you only want to change the number of channels, you can use conv2d.
If you want the opposite spatial connectivity, then you need to use the transposed version.

1 Like

Hello @albanD

Could you explain a bit more detailed by saying opposite spatial connectivity?

Thanks in advance.

Hi,

The visualizations in this blogpost might be clearer than words: Transposed Convolutions explained with… MS Excel! | by Thom Lane | Apache MXNet | Medium

1 Like

I read the whole series. Helped a lot, thanks!!

1 Like