code: def YXbbox2delta(
      proposals,
      gt,
      means=(0.0, 0.0, 0.0, 0.0),
      stds=(1.0, 1.0, 1.0, 1.0),
  ):
      """Compute deltas of proposals w.r.t. gt.
  
      We usually compute the deltas of x, y, w, h of proposals w.r.t ground
      truth bboxes to get regression target.
      This is the inverse function of :func:`delta2bbox`.
  
      Args:
          proposals (Tensor): Boxes to be transformed, shape (N, ..., 4)
          gt (Tensor): Gt bboxes to be used as base, shape (N, ..., 4)
          means (Sequence[float]): Denormalizing means for delta coordinates
          stds (Sequence[float]): Denormalizing standard deviation for delta
              coordinates
  
      Returns:
          Tensor: deltas with shape (N, 4), where columns represent dx, dy,
              dw, dh.
      """
      assert proposals.size() == gt.size()
  
      proposals = proposals.float()
      gt = gt.float()
      py = (proposals[..., 0] + proposals[..., 2]) * 0.5
      px = (proposals[..., 1] + proposals[..., 3]) * 0.5
      ph = proposals[..., 2] - proposals[..., 0]
      pw = proposals[..., 3] - proposals[..., 1]
  
      gx = (gt[..., 0] + gt[..., 2]) * 0.5
      gy = (gt[..., 1] + gt[..., 3]) * 0.5
      gw = gt[..., 2] - gt[..., 0]
      gh = gt[..., 3] - gt[..., 1]
  
      dx = (gx - px) / pw
      dy = (gy - py) / ph
      dw = torch.log(gw / pw)
      dh = torch.log(gh / ph)
      deltas = torch.stack([dy, dx, dh, dw], dim=-1)
  
      means = deltas.new_tensor(means).unsqueeze(0)
      stds = deltas.new_tensor(stds).unsqueeze(0)
      deltas = deltas.sub_(means).div_(stds)
  
      return deltas
  
file_path: mmdetection/projects/EfficientDet/efficientdet/tensorflow/yxyx_bbox_coder.py
imports: import warnings
  import numpy
  import torch
  from mmdet.models.task_modules.coders.delta_xywh_bbox_coder import DeltaXYWHBBoxCoder
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import HorizontalBoxes, get_box_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: YXbbox2delta(proposals, gt, means, stds) and returns: deltas