code: def _get_loss_class(
      self,
      logits,
      gt_class,
      match_indices,
      bg_index,
      num_gts,
      postfix="",
      iou_score=None,
      gt_score=None,
  ):
      # logits: [b, query, num_classes], gt_class: list[[n, 1]]
      name_class = "loss_class" + postfix
  
      target_label = paddle.full(
          logits.shape[:2], bg_index, dtype="int64"
      )
      bs, num_query_objects = target_label.shape
      num_gt = sum(len(a) for a in gt_class)
      if num_gt > 0:
          index, updates = self._get_index_updates(
              num_query_objects, gt_class, match_indices
          )
          target_label = paddle.scatter(
              target_label.reshape([-1, 1]),
              index,
              updates.astype("int64"),
          )
          target_label = target_label.reshape([bs, num_query_objects])
      if self.use_focal_loss:
          target_label = F.one_hot(target_label, self.num_classes + 1)[
              ..., :-1
          ]
          if iou_score is not None and self.use_vfl:
              if gt_score is not None:
                  target_score = paddle.zeros([bs, num_query_objects])
                  target_score = paddle.scatter(
                      target_score.reshape([-1, 1]), index, gt_score
                  )
                  target_score = (
                      target_score.reshape([bs, num_query_objects, 1])
                      * target_label
                  )
  
                  target_score_iou = paddle.zeros(
                      [bs, num_query_objects]
                  )
                  target_score_iou = paddle.scatter(
                      target_score_iou.reshape([-1, 1]),
                      index,
                      iou_score,
                  )
                  target_score_iou = (
                      target_score_iou.reshape(
                          [bs, num_query_objects, 1]
                      )
                      * target_label
                  )
                  target_score = paddle.multiply(
                      target_score, target_score_iou
                  )
                  loss_ = self.loss_coeff[
                      "class"
                  ] * varifocal_loss_with_logits(
                      logits,
                      target_score,
                      target_label,
                      num_gts / num_query_objects,
                  )
              else:
                  target_score = paddle.zeros([bs, num_query_objects])
                  if num_gt > 0:
                      target_score = paddle.scatter(
                          target_score.reshape([-1, 1]),
                          index,
                          iou_score,
                      )
                  target_score = (
                      target_score.reshape([bs, num_query_objects, 1])
                      * target_label
                  )
                  loss_ = self.loss_coeff[
                      "class"
                  ] * varifocal_loss_with_logits(
                      logits,
                      target_score,
                      target_label,
                      num_gts / num_query_objects,
                  )
          else:
              loss_ = self.loss_coeff["class"] * sigmoid_focal_loss(
                  logits, target_label, num_gts / num_query_objects
              )
      else:
          loss_ = F.cross_entropy(
              logits, target_label, weight=self.loss_coeff["class"]
          )
      return {name_class: loss_}
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from .iou_loss import GIoULoss
  from ..transformers import bbox_cxcywh_to_xyxy, sigmoid_focal_loss, varifocal_loss_with_logits
  from ..bbox_utils import bbox_iou
label_desc: Use image node_id 2 for calling the DETRLoss obj's underlying member method code with example usage: obj._get_loss_class(logits, gt_class, match_indices, bg_index, num_gts, postfix, iou_score, gt_score) and returns: dict