code: def loss_computation(
      logits_list,
      semantic,
      semantic_weights,
      center,
      center_weights,
      offset,
      offset_weights,
      losses,
  ):
      # semantic loss
      semantic_loss = losses["types"][0](
          logits_list[0], semantic, semantic_weights
      )
      semantic_loss = semantic_loss * losses["coef"][0]
  
      # center loss
      center_loss = losses["types"][1](logits_list[1], center)
      center_weights = (center_weights.unsqueeze(1)).expand_as(
          center_loss
      )
      center_loss = center_loss * center_weights
      if center_loss.sum() > 0:
          center_loss = center_loss.sum() / center_weights.sum()
      else:
          center_loss = center_loss.sum() * 0
      center_loss = center_loss * losses["coef"][1]
  
      # offset loss
      offset_loss = losses["types"][2](logits_list[2], offset)
      offset_weights = (offset_weights.unsqueeze(1)).expand_as(
          offset_loss
      )
      offset_loss = offset_loss * offset_weights
      if offset_weights.sum() > 0:
          offset_loss = offset_loss.sum() / offset_weights.sum()
      else:
          offset_loss = offset_loss.sum() * 0
      offset_loss = offset_loss * losses["coef"][2]
  
      loss_list = [semantic_loss, center_loss, offset_loss]
  
      return loss_list
  
file_path: PaddleSeg/contrib/PanopticDeepLab/core/train.py
imports: import os
  import time
  from collections import deque
  import shutil
  import paddle
  import paddle.nn.functional
  from paddleseg.utils import TimeAverager, calculate_eta, resume, logger
  from core.val import evaluate
label_desc: Use image node_id 2 for calling a global function with example usage: loss_computation(logits_list, semantic, semantic_weights, center, center_weights, offset, offset_weights, losses) and returns: loss_list