Hi Guys, I am really new to this. I could not figure out this size mismatch. Please help me explain a bit.
this is my network
class Net(nn.Module):

    def __init__(self):
        
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 10, 3)
        self.pool = nn.MaxPool2d(2, 2)
        self.conv2 = nn.Conv2d(10, 20, 3)        
        self.fc1 = nn.Linear(20*5*5, 50)
        self.fc1_drop = nn.Dropout(p=0.4)
        self.fc2 = nn.Linear(50, 10)

    def forward(self, x):
        x = self.pool(F.relu(self.conv1(x)))
        x = self.pool(F.relu(self.conv2(x)))
        x = x.view(x.size(0), -1)
        x = F.relu(self.fc1(x))
        x = self.fc1_drop(x)
        x = self.fc2(x)
        
        return x


this is the error
RuntimeError                              Traceback (most recent call last)
<ipython-input-51-07f935a80088> in <module>()
      1 # call the above function
      2 # returns: test images, test predicted keypoints, test ground truth keypoints
----> 3 test_images, test_outputs, gt_pts = net_sample_output()
      4 
      5 # print out the dimensions of the data to see if they make sense

<ipython-input-39-dcd307a0f805> in net_sample_output()
     14 
     15         # forward pass to get net output
---> 16         output_pts = net(images)
     17 
     18         # reshape to batch_size x 68 x 2 pts

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py 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)

<ipython-input-50-fcf350652c2f> in forward(self, x)
     26         x = self.pool(F.relu(self.conv2(x)))
     27         x = x.view(x.size(0), -1)
---> 28         x = F.relu(self.fc1(x))
     29         x = self.fc1_drop(x)
     30         x = self.fc2(x)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py 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)

/opt/conda/lib/python3.6/site-packages/torch/nn/modules/linear.py 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):

/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py in linear(input, weight, bias)
    990     if input.dim() == 2 and bias is not None:
    991         # fused op is marginally faster
--> 992         return torch.addmm(bias, input, weight.t())
    993 
    994     output = input.matmul(weight.t())

RuntimeError: size mismatch, m1: [10 x 58320], m2: [500 x 50] at /opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/TH/generic/THTensorMath.c:2033