Both are equal if the dimensions are constant because you can change the learning rate.
But if the output dimensions are variable, both approaches will not be appropriate.
Instead, you need to do this
loss = F.mse_loss(y_pred,y_true,reduction='none')
loss = (loss/torch.as_tensor(loss.size()).prod().sqrt()).sum()