class_docstr: Variation from DiceLoss.
  The coverage and union are computed separately.
class_docstr_tok: ["Variation","from","DiceLoss",".","The","coverage","and","union","are","computed","separately","."]
code: def forward(self, pred, gt, mask):
      if pred.dim() == 4:
          pred = pred[:, 0, :, :]
          gt = gt[:, 0, :, :]
      assert pred.shape == gt.shape
      assert pred.shape == mask.shape
  
      coverage = (pred * mask * gt).sum() / (
          (gt * mask).sum() + self.eps
      )
      assert coverage <= 1
      coverage = 1 - coverage
      excede = (pred * mask * gt).sum() / (
          (pred * mask).sum() + self.eps
      )
      assert excede <= 1
      excede = 1 - excede
      loss = coverage * self.coverage_scale + excede
      return loss, dict(coverage=coverage, excede=excede)
  
imports: import torch
  import torch.nn
  import numpy
  import cv2
  from scipy import ndimage
label_desc: Use image node_id 2 for calling the LeakyDiceLoss obj's underlying member method code with example usage: obj.forward(pred, gt, mask) and returns: loss,  dict