loss = cre_loss((output.reshape(-1,2).squeeze()), label.squeeze().reshape(-1).cuda())
        for i in loss_arr:
            loss += i
loss.backward()

Here is the backward() call, this part comes right after the part I posted above. I basically combined all losses(including the “regular” loss between the output and the label)
Is there a way to correctly implement this? I can’t really think of a way to implement this with differentiable operations. Thanks!