class_docstr: SSDLoss
  
  Args:
      overlap_threshold (float32, optional): IoU threshold for negative bboxes
          and positive bboxes, 0.5 by default.
      neg_pos_ratio (float): The ratio of negative samples / positive samples.
      loc_loss_weight (float): The weight of loc_loss.
      conf_loss_weight (float): The weight of conf_loss.
      prior_box_var (list): Variances corresponding to prior box coord, [0.1,
          0.1, 0.2, 0.2] by default.
class_docstr_tok: ["SSDLoss","Args",":","overlap_threshold","(","float32",",","optional",")",":","IoU","threshold","for","negative","bboxes","and","positive","bboxes",",","0.5","by","default",".","neg_pos_ratio","(","float",")",":","The","ratio","of","negative","samples","\/","positive","samples",".","loc_loss_weight","(","float",")",":","The","weight","of","loc_loss",".","conf_loss_weight","(","float",")",":","The","weight","of","conf_loss",".","prior_box_var","(","list",")",":","Variances","corresponding","to","prior","box","coord",",","[","0.1",",","0.1",",","0.2",",","0.2","]","by","default","."]
docstr: Args:
      gt_bbox (Tensor): [B, N, 4]
      gt_label (Tensor): [B, N, 1]
      prior_boxes (Tensor): [A, 4]
      bg_index (int): Background class index
docstr_tok: ["Args",":","gt_bbox","(","Tensor",")",":","[","B",",","N",",","4","]","gt_label","(","Tensor",")",":","[","B",",","N",",","1","]","prior_boxes","(","Tensor",")",":","[","A",",","4","]","bg_index","(","int",")",":","Background","class","index"]
code: def _bipartite_match_for_batch(
      self, gt_bbox, gt_label, prior_boxes, bg_index
  ):
      """
      Args:
          gt_bbox (Tensor): [B, N, 4]
          gt_label (Tensor): [B, N, 1]
          prior_boxes (Tensor): [A, 4]
          bg_index (int): Background class index
      """
      batch_size, num_priors = gt_bbox.shape[0], prior_boxes.shape[0]
      ious = iou_similarity(
          gt_bbox.reshape((-1, 4)), prior_boxes
      ).reshape((batch_size, -1, num_priors))
  
      # For each prior box, get the max IoU of all GTs.
      prior_max_iou, prior_argmax_iou = ious.max(axis=1), ious.argmax(
          axis=1
      )
      # For each GT, get the max IoU of all prior boxes.
      gt_max_iou, gt_argmax_iou = ious.max(axis=2), ious.argmax(axis=2)
  
      # Gather target bbox and label according to 'prior_argmax_iou' index.
      batch_ind = paddle.arange(
          end=batch_size, dtype="int64"
      ).unsqueeze(-1)
      prior_argmax_iou = paddle.stack(
          [batch_ind.tile([1, num_priors]), prior_argmax_iou], axis=-1
      )
      targets_bbox = paddle.gather_nd(gt_bbox, prior_argmax_iou)
      targets_label = paddle.gather_nd(gt_label, prior_argmax_iou)
      # Assign negative
      bg_index_tensor = paddle.full(
          [batch_size, num_priors, 1], bg_index, "int64"
      )
      targets_label = paddle.where(
          prior_max_iou.unsqueeze(-1) < self.overlap_threshold,
          bg_index_tensor,
          targets_label,
      )
  
      # Ensure each GT can match the max IoU prior box.
      batch_ind = (batch_ind * num_priors + gt_argmax_iou).flatten()
      targets_bbox = paddle.scatter(
          targets_bbox.reshape([-1, 4]),
          batch_ind,
          gt_bbox.reshape([-1, 4]),
      ).reshape([batch_size, -1, 4])
      targets_label = paddle.scatter(
          targets_label.reshape([-1, 1]),
          batch_ind,
          gt_label.reshape([-1, 1]),
      ).reshape([batch_size, -1, 1])
      targets_label[:, :1] = bg_index
  
      # Encode box
      prior_boxes = prior_boxes.unsqueeze(0).tile([batch_size, 1, 1])
      targets_bbox = bbox2delta(
          prior_boxes.reshape([-1, 4]),
          targets_bbox.reshape([-1, 4]),
          self.prior_box_var,
      )
      targets_bbox = targets_bbox.reshape([batch_size, -1, 4])
  
      return targets_bbox, targets_label
  
file_path: PaddleDetection/ppdet/modeling/losses/ssd_loss.py
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 ..bbox_utils import iou_similarity, bbox2delta
label_desc: Use image node_id 2 for calling the SSDLoss obj's underlying member method code with example usage: obj._bipartite_match_for_batch(gt_bbox, gt_label, prior_boxes, bg_index) and returns: targets_bbox,  targets_label