code: def loss_computation(logits_list, labels, edges, losses):
      check_logits_losses(logits_list, losses)
      loss_list = []
      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",)
              and loss_i.edge_label
          ):
              # 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 = 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())
              )
          else:
              loss_list.append(coef_i * loss_i(logits, labels))
      return loss_list
  
file_path: PaddleSeg/paddleseg/core/train.py
imports: import os
  import time
  from collections import deque
  import shutil
  from copy import deepcopy
  import paddle
  import paddle.nn.functional
  from paddleseg.utils import TimeAverager, calculate_eta, resume, logger, worker_init_fn, train_profiler, op_flops_funs, init_ema_params, update_ema_model
  from paddleseg.core.val import evaluate
label_desc: Use image node_id 2 for calling a global function with example usage: loss_computation(logits_list, labels, edges, losses) and returns: loss_list