You could calculate the losses separately, accumulate them, and call backward on the final loss to calculate the gradients. Something like this would work:
loss1 = criterion1(output1, target1)
loss2 = criterion2(output2, target2)
loss3 = criterion3(output3, target3)
loss = loss1 + loss2 + loss3
loss.backward()