class_docstr: The implements of the dice loss.
  
  Args:
      weight (list[float], optional): The weight for each class. Default: None.
      ignore_index (int64): ignore_index (int64, optional): 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.
          Default: 1.0
code: def forward(self, logits, labels):
      num_class = logits.shape[1]
      if self.weight is not None:
          assert num_class == len(
              self.weight
          ), "The lenght of weight should be euqal to the num class"
  
      mask = labels != self.ignore_index
      mask = paddle.cast(paddle.unsqueeze(mask, 1), "float32")
  
      labels[labels == self.ignore_index] = 0
      labels_one_hot = F.one_hot(labels, num_class)
      labels_one_hot = paddle.transpose(labels_one_hot, [0, 3, 1, 2])
      logits = F.softmax(logits, axis=1)
  
      dice_loss = 0.0
      for i in range(num_class):
          dice_loss_i = dice_loss_helper(
              logits[:, i],
              labels_one_hot[:, i],
              mask,
              self.smooth,
              self.eps,
          )
          if self.weight is not None:
              dice_loss_i *= self.weight[i]
          dice_loss += dice_loss_i
      dice_loss = dice_loss / num_class
  
      return dice_loss
  
file_path: PaddleSeg/paddleseg/models/losses/dice_loss.py
imports: import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 2 for calling the DiceLoss obj's underlying member method code with example usage: obj.forward(logits, labels) and returns: dice_loss