Since the gradients will be accumulated for each backward pass, it should be the same.
Here is a very simple example:

torch.manual_seed(2809)
model = nn.Linear(10, 2)
x = torch.randn(1, 10)
target1 = torch.randn(1, 2)
target2 = torch.empty(1, dtype=torch.long).random_(2)

criterion1 = nn.MSELoss()
criterion2 = nn.NLLLoss()

output = model(x)

loss1 = criterion1(output, target1)
loss2 = criterion2(F.log_softmax(output, 1), target2)

loss1.backward(retain_graph=True)
loss2.backward()

print(model.weight.grad)

# Sum losses
torch.manual_seed(2809)
model = nn.Linear(10, 2)
x = torch.randn(1, 10)
target1 = torch.randn(1, 2)
target2 = torch.empty(1, dtype=torch.long).random_(2)

criterion1 = nn.MSELoss()
criterion2 = nn.NLLLoss()

loss1 = criterion1(model(x), target1)
loss2 = criterion2(F.log_softmax(model(x), 1), target2)

loss = loss1 + loss2
loss.backward()

print(model.weight.grad)

I think it’s better performance-wise as you will just call backward once.