Note that in forward method, the variable is first passed to features and then classifier, so the input dimension to classifier is the output dimension of features (x.view() is used to flatten dimension. Why is 512 x 7 x 7? That’s because VGG conv layers’ final output size is 512 channel with 7x7.