class_docstr: Implements the dice loss function.
  
  Args:
      ignore_index (int64): Specifies a target value that is ignored
          and does not contribute to the input gradient. Default ``255``.
      smooth (float32): laplace smoothing,
          to smooth dice loss and accelerate convergence. following:
          https://github.com/pytorch/pytorch/issues/1249#issuecomment-337999895
docstr: logits: tensor of [B, C, D, H, W]
  labels: tensor of shape [B, D, H, W]
docstr_tok: ["logits",":","tensor","of","[","B",",","C",",","D",",","H",",","W","]","labels",":","tensor","of","shape","[","B",",","D",",","H",",","W","]"]
code: def forward(self, logits, labels):
      """
      logits: tensor of [B, C, D, H, W]
      labels: tensor of shape [B, D, H, W]
      """
      assert "int" in str(labels.dtype), print(
          "The label should be int but got {}".format(type(labels))
      )
      if len(logits.shape) == 4:
          logits = logits.unsqueeze(0)
  
      labels_one_hot = F.one_hot(
          labels, num_classes=logits.shape[1]
      )  # [B, D, H, W, C]
      labels_one_hot = paddle.transpose(
          labels_one_hot, [0, 4, 1, 2, 3]
      )  # [B, C, D, H, W]
  
      labels_one_hot = paddle.cast(labels_one_hot, dtype="float32")
  
      logits = self.norm(logits)  # softmax to sigmoid
  
      per_channel_dice = self.compute_per_channel_dice(
          logits, labels_one_hot, weight=self.weight
      )
  
      dice_loss = 1.0 - paddle.mean(per_channel_dice)
      per_channel_dice = (
          per_channel_dice.detach().cpu().numpy()
      )  # vnet variant dice
  
      return dice_loss, per_channel_dice
  
file_path: PaddleSeg/contrib/MedicalSeg/medicalseg/models/losses/dice_loss.py
imports: import paddle
  from paddle import nn
  import paddle.nn.functional
  from medicalseg.models.losses import flatten
  from medicalseg.cvlibs import manager
label_desc: Use image node_id 3 for calling the DiceLoss obj's underlying member method code with example usage: obj.forward(logits, labels) and returns: dice_loss,  per_channel_dice