Formula for output shape of convolution and transpose convolution layer

Hello everyone - I was looking for understanding on Conv2d and transpose2d output shape when stride > 1 used with padding = same. I did some research and found few relevant links which support my confusion and thanks for such detailed explanation in the below links

  1. Lecture slide 44 (of 47) -Using Keras to duplicate calculations - #9 by paulinpaloalto
  2. How does padding work in transpose convolution? - #7 by rmwkwok

Also a follow up question, what do we mean by padding for transpose convolution layer?
And is padding done on input or output for transpose convolution?

Does this link on calculating output length per dimension help?

1 Like

Hello, @VivekKapoor,

This medium article (a friend link, which shouldn’t require login) explained my own understanding on it. It should produce consistent results with TF’s and PyTorch’s Transpose Conv2D.

Cheers,
Raymond

1 Like

Prof Ng actually covers this pretty clearly in the Transpose Convolution lecture in DLS C4 W3. The padding is added to the output. Here’s a screenshot from that lecture: