code: def __init__(
      self,
      batch_dice=True,
      smooth=1e-5,
      do_bg=False,
      ce_kwargs={},
      reduction="sum",
      square_dice=False,
      weight_ce=1,
      weight_dice=1,
      log_dice=False,
      ignore_label=None,
  ):
      super(DC_and_CE_loss, self).__init__()
      if ignore_label is not None:
          assert not square_dice, "not implemented"
          ce_kwargs["reduction"] = "none"
      self.log_dice = log_dice
      self.weight_dice = weight_dice
      self.weight_ce = weight_ce
      self.reduction = reduction
      self.ce = RobustCrossEntropyLoss(**ce_kwargs)
  
      self.ignore_label = ignore_label
  
      self.dc = SoftDiceLoss(
          apply_softmax=True,
          batch_dice=batch_dice,
          smooth=smooth,
          do_bg=do_bg,
      )
  
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 1 to create a new DC_and_CE_loss object from inherited base classes: nn with example: obj = DC_and_CE_loss(batch_dice, smooth, do_bg, ce_kwargs, reduction, square_dice, weight_ce, weight_dice, log_dice, ignore_label)