Systematic Way of Computing Layer Dimensionality

Hi everyone,
I’m pretty new to pytorch and building neural nets in general and have been slowly making my way through the cs231n course. One thing that I struggle with (and if I’m any indicator, so do a lot of newbies) is computing the input/output dimensions of each layer so that the network can be glued together properly. I’ve seen many questions here about figuring out how to connect a convolutional layer to a linear layer (or other types of layers) and things of that sort, with one off answers to each person on how to go about computing it.
Is there some kind of calculator out there that I can use to tell me what the input and output size of all of my layers is supposed to be without having to compute it each time? If this is not possible, why not?
Thanks

This is not done by the network because the conv layers don’t have information what input shapes you will run through them.
The usual thing I do (and I think I might not be the only one) is just to run some data through it and print the shape of the result (or just take the error and adjust based on that).

Best regards

Thomas

1 Like