Hello.
I am trying to use resnet50 for image classification.
However it shows error and I could not fix it…
 RuntimeError: inconsistent tensor size, expected tensor [120 x 2048] and src [1000 x 2048] to have the same number of elements, but got 245760 and 2048000 elements respectively at /Users/soumith/code/builder/wheel/pytorch-src/torch/lib/TH/generic/THTensorCopy.c:86  

and error happens below.
        self.resnet = models.resnet50(num_classes=num_breeds, pretrained='imagenet')

Model is below
    class Resnet(nn.Module):
      def __init__(self):
        super(Resnet,self).__init__()
        self.resnet = models.resnet50(num_classes=num_breeds, pretrained='imagenet')
        #self.resnet = nn.Sequential(*list(resnet.children())[:-2])
        #self.fc = nn.Linear(2048,num_breeds)

      def forward(self,x):
        x = self.resnet(x)
        return x

If anybody know why, please help me out.