code: def ciou_loss(pred, target, eps=1e-7):
      r"""`Implementation of paper `Enhancing Geometric Factors into
      Model Learning and Inference for Object Detection and Instance
      Segmentation <https://arxiv.org/abs/2005.03572>`_.
  
      Code is modified from https://github.com/Zzh-tju/CIoU.
  
      Args:
          pred (Tensor): Predicted bboxes of format (x1, y1, x2, y2),
              shape (n, 4).
          target (Tensor): Corresponding gt bboxes, shape (n, 4).
          eps (float): Eps to avoid log(0).
      Return:
          Tensor: Loss tensor.
      """
      # overlap
      lt = torch.max(pred[:, :2], target[:, :2])
      rb = torch.min(pred[:, 2:], target[:, 2:])
      wh = (rb - lt).clamp(min=0)
      overlap = wh[:, 0] * wh[:, 1]
  
      # union
      ap = (pred[:, 2] - pred[:, 0]) * (pred[:, 3] - pred[:, 1])
      ag = (target[:, 2] - target[:, 0]) * (target[:, 3] - target[:, 1])
      union = ap + ag - overlap + eps
  
      # IoU
      ious = overlap / union
  
      # enclose area
      enclose_x1y1 = torch.min(pred[:, :2], target[:, :2])
      enclose_x2y2 = torch.max(pred[:, 2:], target[:, 2:])
      enclose_wh = (enclose_x2y2 - enclose_x1y1).clamp(min=0)
  
      cw = enclose_wh[:, 0]
      ch = enclose_wh[:, 1]
  
      c2 = cw**2 + ch**2 + eps
  
      b1_x1, b1_y1 = pred[:, 0], pred[:, 1]
      b1_x2, b1_y2 = pred[:, 2], pred[:, 3]
      b2_x1, b2_y1 = target[:, 0], target[:, 1]
      b2_x2, b2_y2 = target[:, 2], target[:, 3]
  
      w1, h1 = b1_x2 - b1_x1, b1_y2 - b1_y1 + eps
      w2, h2 = b2_x2 - b2_x1, b2_y2 - b2_y1 + eps
  
      left = ((b2_x1 + b2_x2) - (b1_x1 + b1_x2)) ** 2 / 4
      right = ((b2_y1 + b2_y2) - (b1_y1 + b1_y2)) ** 2 / 4
      rho2 = left + right
  
      factor = 4 / math.pi**2
      v = factor * torch.pow(
          torch.atan(w2 / h2) - torch.atan(w1 / h1), 2
      )
  
      # CIoU
      cious = ious - (rho2 / c2 + v**2 / (1 - ious + v))
      loss = 1 - cious
      return loss
  
imports: import math
  import torch
  import torch.nn
  from mmdet.core import bbox_overlaps
  from ..builder import LOSSES
  from .utils import weighted_loss
label_desc: Use image node_id 5 for calling a global function with example usage: ciou_loss(pred, target, eps) and returns: loss