nn.MSELoss expects to the output of your model and the corresponding target.
Based on your code, you should calculate the loss as loss = criterion(out, train_y).
Also, make sure out and train_y have the same shape.