code: def forward(self, net_output, target):
      if self.ignore_label is not None:
          assert (
              target.shape[1] == 1
          ), "not implemented for one hot encoding"
          mask = target != self.ignore_label
          target[~mask] = 0
          mask = mask.float()
      else:
          mask = None
  
      dc = (
          self.dc(net_output, target, loss_mask=mask)
          if self.weight_dice != 0
          else 0
      )
      dice_coef = dc
      dc_loss = -dc.mean()
      if self.log_dice:
          dc_loss = -paddle.log(-dc_loss)
  
      ce_loss = (
          self.ce(net_output, target[:, 0].astype("float32"))
          if self.weight_ce != 0
          else 0
      )
      if self.ignore_label is not None:
          ce_loss *= mask[:, 0]
          ce_loss = ce_loss.sum() / mask.sum()
  
      if self.reduction == "sum":
          result = self.weight_ce * ce_loss + self.weight_dice * dc_loss
      else:
          raise NotImplementedError(
              "reduction type not support, only support 'sum'."
          )
      return result, dice_coef.numpy()
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/losses/dice_and_ce_loss.py
imports: import numpy
  import paddle
  from paddle import nn
  import paddle.nn.functional
  from medicalseg.cvlibs import manager
label_desc: Use image node_id 2 for calling the DC_and_CE_loss obj's underlying member method code with example usage: obj.forward(net_output, target) and returns: result,  dice_coef