Hi,
As you are using convolutional filters, you don t have to specify the input height and with. Yet, as at the end of your classifiers there are linear layers, you can actually retreive the input size from the first linear layer input size which is here 16x5x5.
Here is the reasonning I use:
5x5 convolutional filters without padding and with stride=1 change size from HxWxC (layer input size) to (H-4)x(W-4)xC’ (layer output size)
2x2 max pooling layers devide the size of both dimensions by 2 so we go from HxWxC (layer input size) to H/2xW/2xC (layer output size)
Hence we just have to propagate back those informations from the first linear unit input size.
Since last conv layer has 16 filters, you know the output of the last conv layer has size: 5x5x16, so it goes as following inversing the transformations listed above:
32x32x3
28x28x6
14x14x6
10x10x16
5x5x16
There you go.
One last this to notice is that I used HxWxC notations while Pytorch convention is CxHxW but reasonning remains unchanged.
To conclude, the height, width information are implicit in this code and if you use fully convolutionnal network, not even necessary.