class_docstr: The Maskformer loss implemeted with PaddlePaddle.
  
  Args:
      num_classes(int): The number of classes that you want this network to classify. Default:150.
      eos_coef(float): The weight coefficient of the last class. Default: 0.1.
      losses(Tuple): The category of losses that you want to compute. Default: ("labels", 'masks').
      ignore_index(int): The ignored label when we calculate the loss. Default:255.
class_docstr_tok: ["The","Maskformer","loss","implemeted","with","PaddlePaddle",".","Args",":","num_classes","(","int",")",":","The","number","of","classes","that","you","want","this","network","to","classify",".","Default:150.","eos_coef","(","float",")",":","The","weight","coefficient","of","the","last","class",".","Default",":","0.1.","losses","(","Tuple",")",":","The","category","of","losses","that","you","want","to","compute",".","Default",":","(","``","labels","''",",","'masks","'",")",".","ignore_index","(","int",")",":","The","ignored","label","when","we","calculate","the","loss",".","Default:255","."]
docstr: Classification loss (NLL)
  targets dicts must contain the key "labels" containing a tensor of dim [nb_target_boxes]
docstr_tok: ["Classification","loss","(","NLL",")","targets","dicts","must","contain","the","key","``","labels","''","containing","a","tensor","of","dim","[","nb_target_boxes","]"]
code: def loss_labels(self, outputs, targets, indices, num_masks):
      """Classification loss (NLL)
      targets dicts must contain the key "labels" containing a tensor of dim [nb_target_boxes]
      """
      targets_cpt, indices_cpt = [], []
      for t, indice in zip(targets, indices):
          if t["labels"].shape[0] != 0:
              targets_cpt.append(t)
              indices_cpt.append(indice)
      else:
          if indices_cpt == []:
              losses = {"loss_ce": paddle.to_tensor([0.0])}
              return losses
  
      assert (
          "pred_logits" in outputs
      ), "The 'pred_logits' need to be in outputs, but only got keys: {}".format(
          outputs.keys()
      )
  
      src_logits = outputs["pred_logits"]
      idx = self._get_src_permutation_idx(indices)
      target_classes_o = paddle.concat(
          [
              t["labels"][J]
              for t, (_, J) in zip(targets_cpt, indices_cpt)
          ]
      )
      target_classes = paddle.full(
          src_logits.shape[:2], self.num_classes, dtype="int64"
      )
      target_classes[idx] = target_classes_o
  
      loss_ce = F.cross_entropy(
          src_logits.transpose((0, 2, 1)).cast("float32"),
          target_classes,
          weight=self.empty_weight,
          axis=1,
          use_softmax=True,
          ignore_index=255,
      )
      losses = {"loss_ce": loss_ce}
      return losses
  
imports: import copy
  import numpy
  from scipy.optimize import linear_sum_assignment
  import paddle
  import paddle.nn
  import paddle.distributed
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
label_desc: Use image node_id 2 for calling the MaskFormerLoss obj's underlying member method code with example usage: obj.loss_labels(outputs, targets, indices, num_masks) and returns: losses, losses