Thanks for the link!
There seem to be some issues in your training loop.
You are doing the following:
inputs = Variable(inputs).cuda()
labels = Variable(labels).cuda()
    
outputs = model_pytorch(inputs)
probs = F.sigmoid(outputs)
probs_flat = probs.view(-1)
labels_flat = probs.view(-1)
loss = loss_function(probs_flat, labels_flat.float())

You are using probs for probs_flat and labels_flat. Your loss function should therefore return a zero loss.
However, you also call F.sigmoid() twice on outputs! The first time in the training loop and then again in your loss definition:
class DiceLoss(_Loss):
    def forward(self, input, target):
        return 1 - dice_coeff(F.sigmoid(input), target)

This seems to be wrong.
Could you fix that and see if your model is learning?