If you changed the architecture, this most likely happens because the output of the convolution that you view for the linear layer does not have the right size compared to what the linear layer expects.
In particular, you want to add prints around this line out = out.view(out.size(0), -1) to make sure the size you have match what self.fc1 expects.