code: def loss_computation(logits_list, labels, losses, edges=None):
      check_logits_losses(logits_list, losses)
      loss_list = []
      per_channel_dice = None
  
      for i in range(len(logits_list)):
          logits = logits_list[i]
          loss_i = losses["types"][i]
          coef_i = losses["coef"][i]
  
          if (
              loss_i.__class__.__name__ in ("BCELoss", "FocalLoss")
              and loss_i.edge_label
          ):
              # If use edges as labels According to loss type.
              loss_list.append(coef_i * loss_i(logits, edges))
          elif loss_i.__class__.__name__ == "MixedLoss":
              mixed_loss_list, per_channel_dice = loss_i(logits, labels)
              for mixed_loss in mixed_loss_list:
                  loss_list.append(coef_i * mixed_loss)
          elif loss_i.__class__.__name__ in ("KLLoss",):
              loss_list.append(
                  coef_i
                  * loss_i(logits_list[0], logits_list[1].detach())
              )
          elif loss_i.__class__.__name__ in [
              "DiceLoss",
              "MultipleLoss",
          ]:
              loss, per_channel_dice = loss_i(logits, labels)
              loss_list.append(coef_i * loss)
          else:
              loss_list.append(coef_i * loss_i(logits, labels))
  
      return loss_list, per_channel_dice
  
label_desc: Use image node_id 2 for calling a global function with example usage: loss_computation(logits_list, labels, losses, edges) and returns: loss_list,  per_channel_dice