Question regarding the Neural Network tutorial

In this tutorial (https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html), it says that:

Note: Expected input size to this net(LeNet) is 32x32. To use this net on MNIST dataset, please resize the images from the dataset to 32x32.

I dont understand where in the network we define it that the input should be 32x32.

I also try different input and it gives me error but im not sure why?

What should i do if i want to change the size from 32 to 120x120 for example?

Got it, nvm :slight_smile:

I have the same question. How did you end up doing this? Thank you.

1 Like

What was the solution?

If the model does not use any adaptive pooling layers but linear layers at the end, the number of input features to the first linear layer basically defines the expected input shape.
E.g. if the input features are set as 64, the previous activation might be e.g. [batch_size, 1, 8, 8] or any other valid combination which results in 64 input activations.

Adaptive pooling layers relax this condition, as they define the output shape and use an adaptive kernel.
Also fully convolutional networks shouldn’t have any size requirements.

CC @ryanjh88