Print the shape of x before passing it to the linear layer and make sure the number of features in the activation match the in_features from the linear layer.
Also, x = x.view(x.shape, -1) won’t change the shape of the activation, so you might want to use the commented approach.