code: def convert_boxes_to_locations(
      gt_boxes: Tensor,
      prior_boxes: Tensor,
      center_variance: float,
      size_variance: float,
  ):
      """
      This function implements Eq.(2) in the `SSD paper <https://arxiv.org/pdf/1512.02325.pdf>`_
  
      Args:
          gt_boxes (Tensor): Ground truth boxes in center form (cx, cy, w, h)
          prior_boxes (Tensor): Prior boxes in center form (cx, cy, w, h)
          center_variance (float): variance value for centers (c_x and c_y)
          size_variance (float): variance value for size (height and width)
  
      Returns:
          boxes tensor for training
      """
  
      # T_cx = ((g_cx - d_cx) / d_w) / center_variance; Center vairance is nothing but normalization
      # T_cy = ((g_cy - d_cy) / d_h) / center_variance
      # T_w = log(g_w/d_w) / size_variance and T_h = log(g_h/d_h) / size_varianc
  
      # priors can have one dimension less
      if prior_boxes.dim() + 1 == gt_boxes.dim():
          prior_boxes = prior_boxes.unsqueeze(0)
  
      target_centers = (
          (gt_boxes[..., :2] - prior_boxes[..., :2])
          / prior_boxes[..., 2:]
      ) / center_variance
      target_size = (
          torch.log(gt_boxes[..., 2:] / prior_boxes[..., 2:])
          / size_variance
      )
      return torch.cat((target_centers, target_size), dim=-1)
  
imports: import torch
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: convert_boxes_to_locations(gt_boxes, prior_boxes, center_variance, size_variance) and returns: torch