I have added the adaptive avg pooling but error still remain the same. Please help?
RuntimeError: size mismatch, m1: [512 x 1], m2: [512 x 2] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:249
Detailed Error
Exception NameError: “global name ‘FileNotFoundError’ is not defined” in <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7fcf3cf65990>> ignored
RuntimeError Traceback (most recent call last)
in ()
1 model_conv = train_model(model_conv, criterion, optimizer_ft, exp_lr_scheduler,
----> 2 num_epochs=25)
in train_model(model, criterion, optimizer, scheduler, num_epochs)
34 # print (inputs.shape)
35 # print (model)
—> 36 outputs = model(inputs)
37 _, preds = torch.max(outputs, 1)
38 # print (outputs)
/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.pyc in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
–> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
in forward(self, x)
62 # x = F.relu(F.max_pool2d(self.conv1(x), 2))
63 # x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2))
—> 64 x = self.model_f(x)
65 # x = x.view(-1, 14336)
66 # x = F.relu(self.fc1(x))
/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.pyc in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
–> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.pyc in forward(self, input)
89 def forward(self, input):
90 for module in self._modules.values():
—> 91 input = module(input)
92 return input
93
/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.pyc in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
–> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)
/usr/local/lib/python2.7/dist-packages/torch/nn/modules/linear.pyc in forward(self, input)
53
54 def forward(self, input):
—> 55 return F.linear(input, self.weight, self.bias)
56
57 def extra_repr(self):
/usr/local/lib/python2.7/dist-packages/torch/nn/functional.pyc in linear(input, weight, bias)
992 return torch.addmm(bias, input, weight.t())
993
–> 994 output = input.matmul(weight.t())
995 if bias is not None:
996 output += bias
RuntimeError: size mismatch, m1: [512 x 1], m2: [512 x 2] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:249