Snippet of my code implementation on PyTorch is:
model = models.vgg16(pretrained = False)
classifier = nn.Sequential(
nn.Linear(25088, 128),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(128, 128),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(128, 20)
)
model.classifier = classifier
I'm feeding images of input size (60x60x3) and batch_size = 30.
When I run the code from Linux (Ubuntu) Terminal (with PyTorch Version: 1.0.0, Torchvision Version: 0.2.1) it gives me, the following error message:
RuntimeError: size mismatch, m1: [30 x 512], m2: [25088 x 128]
While, when I run it from Spyder (Anaconda) on Windows (with PyTorch Version: 1.0.1, Torchvision Version: 0.2.2), it runs perfectly.
Am I missing something or is this because of some version mismatch in Pytorch and Torchvision? Both, I'm running on Python 3.6. Please suggest.
[UPDATE: Mistakenly interchanged the version numbers for the error-case and error-free case. Thanks @Manoj Mohan for pointing it out]