code: def __init__(
      self, losses, coef, ignore_index=255, plan_path=None, stage=None
  ):
      super(MultipleLoss, self).__init__()
      if not isinstance(losses, list):
          raise TypeError("`losses` must be a list!")
      if not isinstance(coef, list):
          raise TypeError("`coef` must be a list!")
      len_losses = len(losses)
      len_coef = len(coef)
      if len_losses != len_coef:
          raise ValueError(
              "The length of `losses` should equal to `coef`, but they are {} and {}.".format(
                  len_losses, len_coef
              )
          )
  
      self.loss = losses[0]
      self.coef = coef
      self.stage = stage
      self.load_plans(plan_path)
  
      net_numpool = len(self.net_num_pool_op_kernel_sizes)
  
      weights = np.array([1 / (2**i) for i in range(net_numpool)])
  
      mask = np.array(
          [True]
          + [
              True if i < net_numpool - 1 else False
              for i in range(1, net_numpool)
          ]
      )
      weights[~mask] = 0
      weights = weights / weights.sum()
      self.weight_factors = weights
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/losses/multiple_losses.py
imports: import pickle
  import numpy
  from paddle import nn
  from medicalseg.cvlibs import manager
label_desc: Use image node_id 1 to create a new MultipleLoss object from inherited base classes: nn with example: obj = MultipleLoss(losses, coef, ignore_index, plan_path, stage)