Nicholas_Wickman:

What is “nn.Linear(512 * 7 * 7, 4096)”? Where do we get these values from?


51277 comes from the very last convolutional layer. 512 is the number of channels in its output and 7x7 is the dimension. You cannot change these values without changing, either the input image size so or parameters of another layer (e.g., stride size) so that the output of last convolutional layer is 512x5x5.