Yes, but note that there is another level of subtlety here: the definition of “same” is not as straightforward as you would think at first glance. In both normal and transpose convolutions, “same” padding only actually preserves the size in the case that stride = 1
.
Here’s a thread which gives more detail on that. If you read the subsequent posts on that thread after the one I linked, it shows examples of the output sizes for both types of convolutions.
Also note that transpose convolutions introduce one other problem: there is some ambiguity about the output size, because on normal convolutions there are multiple input sizes that can result in the same output size. So the function being “inverted” is not one-to-one.
Here’s a thread from mentor Raymond that discusses that in more detail.