class_docstr: The linear box-to-box transform defined in FCOS. The transformation is parameterized
  by the distance from the center of (square) src box to 4 edges of the target box.
class_docstr_tok: ["The","linear","box-to-box","transform","defined","in","FCOS",".","The","transformation","is","parameterized","by","the","distance","from","the","center","of","(","square",")","src","box","to","4","edges","of","the","target","box","."]
docstr: Apply transformation `deltas` (dx1, dy1, dx2, dy2) to `boxes`.
  
  Args:
      deltas (Tensor): transformation deltas of shape (N, k*4), where k >= 1.
          deltas[i] represents k potentially different class-specific
          box transformations for the single box boxes[i].
      boxes (Tensor): boxes to transform, of shape (N, 4)
docstr_tok: ["Apply","transformation","`","deltas","`","(","dx1",",","dy1",",","dx2",",","dy2",")","to","`","boxes","`",".","Args",":","deltas","(","Tensor",")",":","transformation","deltas","of","shape","(","N",",","k","*","4",")",",","where","k",">","=","1.","deltas","[","i","]","represents","k","potentially","different","class-specific","box","transformations","for","the","single","box","boxes","[","i","]",".","boxes","(","Tensor",")",":","boxes","to","transform",",","of","shape","(","N",",","4",")"]
code: def apply_deltas(self, deltas, boxes):
      """
      Apply transformation `deltas` (dx1, dy1, dx2, dy2) to `boxes`.
  
      Args:
          deltas (Tensor): transformation deltas of shape (N, k*4), where k >= 1.
              deltas[i] represents k potentially different class-specific
              box transformations for the single box boxes[i].
          boxes (Tensor): boxes to transform, of shape (N, 4)
      """
      # Ensure the output is a valid box. See Sec 2.1 of https://arxiv.org/abs/2006.09214
      deltas = F.relu(deltas)
      boxes = boxes.to(deltas.dtype)
  
      ctr_x = 0.5 * (boxes[:, 0] + boxes[:, 2])
      ctr_y = 0.5 * (boxes[:, 1] + boxes[:, 3])
      if self.normalize_by_size:
          stride_w = boxes[:, 2] - boxes[:, 0]
          stride_h = boxes[:, 3] - boxes[:, 1]
          strides = torch.stack(
              [stride_w, stride_h, stride_w, stride_h], axis=1
          )
          deltas = deltas * strides
  
      l = deltas[:, 0::4]
      t = deltas[:, 1::4]
      r = deltas[:, 2::4]
      b = deltas[:, 3::4]
  
      pred_boxes = torch.zeros_like(deltas)
      pred_boxes[:, 0::4] = ctr_x[:, None] - l  # x1
      pred_boxes[:, 1::4] = ctr_y[:, None] - t  # y1
      pred_boxes[:, 2::4] = ctr_x[:, None] + r  # x2
      pred_boxes[:, 3::4] = ctr_y[:, None] + b  # y2
      return pred_boxes
  
file_path: detectron2/detectron2/modeling/box_regression.py
imports: import math
  from typing import List, Tuple, Union
  import torch
  from fvcore.nn import giou_loss, smooth_l1_loss
  from torch.nn import functional
  from detectron2.layers import cat, ciou_loss, diou_loss
  from detectron2.structures import Boxes
label_desc: Use image node_id 3 for calling the Box2BoxTransformLinear obj's underlying member method code with example usage: obj.apply_deltas(deltas, boxes) and returns: pred_boxes