class_docstr: FCOSLoss
  Args:
      loss_alpha (float): alpha in focal loss
      loss_gamma (float): gamma in focal loss
      iou_loss_type (str): location loss type, IoU/GIoU/LINEAR_IoU
      reg_weights (float): weight for location loss
      quality (str): quality branch, centerness/iou
docstr: Calculate the loss for location prediction
  Args:
      pred (Tensor): bounding boxes prediction
      targets (Tensor): targets for positive samples
      positive_mask (Tensor): mask of positive samples
      weights (Tensor): weights for each positive samples
  Return:
      loss (Tensor): location loss
docstr_tok: ["Calculate","the","loss","for","location","prediction","Args",":","pred","(","Tensor",")",":","bounding","boxes","prediction","targets","(","Tensor",")",":","targets","for","positive","samples","positive_mask","(","Tensor",")",":","mask","of","positive","samples","weights","(","Tensor",")",":","weights","for","each","positive","samples","Return",":","loss","(","Tensor",")",":","location","loss"]
code: def _iou_loss(
      self, pred, targets, positive_mask, weights=None, return_iou=False
  ):
      """
      Calculate the loss for location prediction
      Args:
          pred (Tensor): bounding boxes prediction
          targets (Tensor): targets for positive samples
          positive_mask (Tensor): mask of positive samples
          weights (Tensor): weights for each positive samples
      Return:
          loss (Tensor): location loss
      """
      plw = pred[:, 0] * positive_mask
      pth = pred[:, 1] * positive_mask
      prw = pred[:, 2] * positive_mask
      pbh = pred[:, 3] * positive_mask
  
      tlw = targets[:, 0] * positive_mask
      tth = targets[:, 1] * positive_mask
      trw = targets[:, 2] * positive_mask
      tbh = targets[:, 3] * positive_mask
      tlw.stop_gradient = True
      trw.stop_gradient = True
      tth.stop_gradient = True
      tbh.stop_gradient = True
  
      ilw = paddle.minimum(plw, tlw)
      irw = paddle.minimum(prw, trw)
      ith = paddle.minimum(pth, tth)
      ibh = paddle.minimum(pbh, tbh)
  
      clw = paddle.maximum(plw, tlw)
      crw = paddle.maximum(prw, trw)
      cth = paddle.maximum(pth, tth)
      cbh = paddle.maximum(pbh, tbh)
  
      area_predict = (plw + prw) * (pth + pbh)
      area_target = (tlw + trw) * (tth + tbh)
      area_inter = (ilw + irw) * (ith + ibh)
      ious = (area_inter + 1.0) / (
          area_predict + area_target - area_inter + 1.0
      )
      ious = ious * positive_mask
  
      if return_iou:
          return ious
  
      if self.iou_loss_type.lower() == "linear_iou":
          loss = 1.0 - ious
      elif self.iou_loss_type.lower() == "giou":
          area_uniou = area_predict + area_target - area_inter
          area_circum = (clw + crw) * (cth + cbh) + 1e-7
          giou = ious - (area_circum - area_uniou) / area_circum
          loss = 1.0 - giou
      elif self.iou_loss_type.lower() == "iou":
          loss = 0.0 - paddle.log(ious)
      else:
          raise KeyError
      if weights is not None:
          loss = loss * weights
      return 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 ppdet.modeling import ops
  from functools import partial
label_desc: Use image node_id 2 for calling the FCOSLoss obj's underlying member method code with example usage: obj._iou_loss(pred, targets, positive_mask, weights, return_iou) and returns: loss, ious