Solved by mathematics in post #2 
              
              
                I expect, your problem is when using view         x = x.view(x.size(0), 3 * 224 * 224) which is giving error, 
without  providing explicit shape it might be better to use 
x.view(x.shape[0],-1) 
Another problem might be in self.fc1 and self.fc2 
As we know,  torch.nn.Linear(in_features, out_features…