Solved by ptrblck in post #2 
              
              
                You should get a warning, which points to a shape mismatch: 

UserWarning: Using a target size (torch.Size([32])) that is different to the input size (torch.Size([32, 1])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size. 
return F.mse_loss(input…