I think that solves it, thank you!
One issue is even though the outputs and the subsequent loss is now calculated, the code now gets stuck on the backward pass. Not entirely sure whether this issue is directly related, though I do not encounter it in the single-GPU case.