So I wanted to know is there any difference between the gradients produced by the following 2 pieces of code or in any other matter:
criterion = nn.MSELoss()
loss = criterion(outputs, labels)

and
loss = torch.mean((output-labels) ** 2)

NOTE: The output is a batch of outputs.