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","."]
code: def forward(self, boxes, scores, gt_bbox, gt_label, prior_boxes):
      boxes = paddle.concat(boxes, axis=1)
      scores = paddle.concat(scores, axis=1)
      gt_label = gt_label.unsqueeze(-1).astype("int64")
      prior_boxes = paddle.concat(prior_boxes, axis=0)
      bg_index = scores.shape[-1] - 1
  
      # Match bbox and get targets.
      targets_bbox, targets_label = self._bipartite_match_for_batch(
          gt_bbox, gt_label, prior_boxes, bg_index
      )
      targets_bbox.stop_gradient = True
      targets_label.stop_gradient = True
  
      # Compute regression loss.
      # Select positive samples.
      bbox_mask = paddle.tile(targets_label != bg_index, [1, 1, 4])
      if bbox_mask.astype(boxes.dtype).sum() > 0:
          location = paddle.masked_select(boxes, bbox_mask)
          targets_bbox = paddle.masked_select(targets_bbox, bbox_mask)
          loc_loss = F.smooth_l1_loss(
              location, targets_bbox, reduction="sum"
          )
          loc_loss = loc_loss * self.loc_loss_weight
      else:
          loc_loss = paddle.zeros([1])
  
      # Compute confidence loss.
      conf_loss = F.cross_entropy(
          scores, targets_label, reduction="none"
      )
      # Mining hard examples.
      label_mask = self._mine_hard_example(
          conf_loss.squeeze(-1), targets_label.squeeze(-1), bg_index
      )
      conf_loss = paddle.masked_select(
          conf_loss, label_mask.unsqueeze(-1)
      )
      conf_loss = conf_loss.sum() * self.conf_loss_weight
  
      # Compute overall weighted loss.
      normalizer = (
          (targets_label != bg_index)
          .astype("float32")
          .sum()
          .clip(min=1)
      )
      loss = (conf_loss + loc_loss) / normalizer
  
      return loss
  
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 4 for calling the SSDLoss obj's underlying member method code with example usage: obj.forward(boxes, scores, gt_bbox, gt_label, prior_boxes) and returns: loss