ptrblck:

x = x.view(x.size(0), -1)



i got another error:

raceback (most recent call last):
  File "C:/Users/BHAAK/Desktop/ML_PATH/dirty-hands/dirty hands file 1/parser.py", line 116, in <module>
    training_loop(5, optim, clf, criterion, trainLoader)
  File "C:/Users/BHAAK/Desktop/ML_PATH/dirty-hands/dirty hands file 1/parser.py", line 89, in training_loop
    output = clf(imgs)
  File "C:\Users\BHAAK\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:/Users/BHAAK/Desktop/ML_PATH/dirty-hands/dirty hands file 1/parser.py", line 71, in forward
    x = F.relu(self.fc1(x))
  File "C:\Users\BHAAK\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\BHAAK\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\linear.py", line 91, in forward
    return F.linear(input, self.weight, self.bias)
  File "C:\Users\BHAAK\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\functional.py", line 1674, in linear
    ret = torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch, m1: [20 x 9000], m2: [180000 x 50] at ..\aten\src\TH/generic/THTensorMath.cpp:41

x shape after the line you told me to replace with:
 torch.Size([20, 9000])
x shape before the line you told me to replace with:
torch.Size([20, 10, 30, 30]) # this is the shape without flatting
is there any idea about what’s happening !