Solved by ptrblck in post #7 
              
              
                The error is raised, because you are not flattening the activation before feeding it into the linear layer. 
Once it’s flattened via out.view(out.size(0), -1), you’ll hit a shape mismatch error and would need to change the in_features of self.fc1. This code should work: 
class Model1(torch.nn.Module…