Unlike fully connected linear layers, convolutions layers need a bit of work to calculate the size of the data as it passes through them.
There aren’t many easy to understand guides on how convolution works. Many report that transposed convolution is particularly difficult to understand.
As part of my upcoming book on GANs with PyTorch I include an appendix with worked examples of convolutions and transposed convolutions, which I’ve also published a version of online for free access.
https://makeyourownneuralnetwork.blogspot.com/2020/02/calculating-output-size-of-convolutions.html 27
I’d be happy if you thought these should be included in the Pytorch tutorials, or linked to from there.
Also happy to receive feedback on improving them.
The main point of the guide is to develop an intuitive understanding, avoiding too much mathematical jargon.
An example of the friendly style of diagrams used …

appendix_C_eg_72950×1179 285 KB