Solved by dashesy in post #2 
              
              
                Thanks to the workaround here: 
Instead of returning a tuple of 0-dim tensors for loss: 
    return tuple(loss_list)

if I return: 
    return torch.stack(loss_list).squeeze()

Everything works.