original_docstring: 
      Apply deltas to shift/scale base boxes.
  
      Typically the rois are anchor or proposed bounding boxes and the deltas are
      network outputs used to shift/scale those boxes.
  
      Args:
          rois (Tensor): boxes to be transformed. Has shape (N, 4)
          deltas (Tensor): encoded offsets with respect to each roi.
              Has shape (N, 6). Note N = num_anchors * W * H when rois is a grid
              of anchors. Offset encoding follows [1]_.
          means (list): denormalizing means for delta coordinates
          stds (list): denormalizing standard deviation for delta coordinates
          max_shape (tuple[int, int]): maximum bounds for boxes. specifies (H, W)
          wh_ratio_clip (float): maximum aspect ratio for boxes.
  
      Returns:
          Tensor: boxes with shape (N, 4), where columns represent
              tl_x, tl_y, br_x, br_y.
  
      References:
          .. [1] https://arxiv.org/abs/1311.2524
      
docstring: Apply deltas to shift/scale base boxes.
  Typically the rois are anchor or proposed bounding boxes and the deltas are
  network outputs used to shift/scale those boxes.
docstring_tokens: Apply deltas to shift / scale base boxes . Typically the rois are anchor or proposed bounding boxes and the deltas are network outputs used to shift / scale those boxes .
code: def delta2sphere(rois,
                   deltas,
                   means=[0, 0, 0, 0],
                   stds=[1, 1, 1, 1],
                   max_shape=None,
                   wh_ratio_clip=16 / 1000):
      """
      Apply deltas to shift/scale base boxes.
  
      Typically the rois are anchor or proposed bounding boxes and the deltas are
      network outputs used to shift/scale those boxes.
  
      Args:
          rois (Tensor): boxes to be transformed. Has shape (N, 4)
          deltas (Tensor): encoded offsets with respect to each roi.
              Has shape (N, 6). Note N = num_anchors * W * H when rois is a grid
              of anchors. Offset encoding follows [1]_.
          means (list): denormalizing means for delta coordinates
          stds (list): denormalizing standard deviation for delta coordinates
          max_shape (tuple[int, int]): maximum bounds for boxes. specifies (H, W)
          wh_ratio_clip (float): maximum aspect ratio for boxes.
  
      Returns:
          Tensor: boxes with shape (N, 4), where columns represent
              tl_x, tl_y, br_x, br_y.
  
      References:
          .. [1] https://arxiv.org/abs/1311.2524
      """
      means = deltas.new_tensor(means).repeat(1, deltas.size(1) // 4)
      stds = deltas.new_tensor(stds).repeat(1, deltas.size(1) // 4)
      denorm_deltas = deltas * stds + means
      dx = denorm_deltas[:, 0::4]
      dy = denorm_deltas[:, 1::4]
      dz = denorm_deltas[:, 2::4]
      dr = denorm_deltas[:, 3::4]
      max_ratio = np.abs(np.log(wh_ratio_clip))
      dr = dr.clamp(min=-max_ratio, max=max_ratio)
      # Compute center of each roi
      px = rois[:, 0:1].expand_as(dx)
      py = rois[:, 1:2].expand_as(dy)
      pz = rois[:, 2:3].expand_as(dz)
      pr = rois[:, 3:4].expand_as(dr)
      # Use exp(network energy) to enlarge/shrink each roi
      gr = pr * dr.exp()
      # Use network energy to shift the center of each roi
      gx = torch.addcmul(px, 1, pr, dx)  # gx = px + pr * dx
      gy = torch.addcmul(py, 1, pr, dy)  # gy = py + ph * dy
      gz = torch.addcmul(pz, 1, pr, dz)  # gz = pz + pd * dz
      # Convert center-xy/width/height to top-left, bottom-right
      out_spheres = torch.stack([gx, gy, gz, gr], dim=-1).view_as(deltas)
      return out_spheres
code_tokens: def delta2sphere ( rois , deltas , means = [ 0 , 0 , 0 , 0 ] , stds = [ 1 , 1 , 1 , 1 ] , max_shape = None , wh_ratio_clip = 16 / 1000 ) : means = deltas . new_tensor ( means ) . repeat ( 1 , deltas . size ( 1 ) // 4 ) stds = deltas . new_tensor ( stds ) . repeat ( 1 , deltas . size ( 1 ) // 4 ) denorm_deltas = deltas * stds + means dx = denorm_deltas [ : , 0 : : 4 ] dy = denorm_deltas [ : , 1 : : 4 ] dz = denorm_deltas [ : , 2 : : 4 ] dr = denorm_deltas [ : , 3 : : 4 ] max_ratio = np . abs ( np . log ( wh_ratio_clip ) ) dr = dr . clamp ( min = - max_ratio , max = max_ratio ) px = rois [ : , 0 : 1 ] . expand_as ( dx ) py = rois [ : , 1 : 2 ] . expand_as ( dy ) pz = rois [ : , 2 : 3 ] . expand_as ( dz ) pr = rois [ : , 3 : 4 ] . expand_as ( dr ) gr = pr * dr . exp ( ) gx = torch . addcmul ( px , 1 , pr , dx ) gy = torch . addcmul ( py , 1 , pr , dy ) gz = torch . addcmul ( pz , 1 , pr , dz ) out_spheres = torch . stack ( [ gx , gy , gz , gr ] , dim = - 1 ) . view_as ( deltas ) return out_spheres
short_docstring: Apply deltas to shift/scale base boxes.
short_docstring_tokens: Apply deltas to shift / scale base boxes .
comment: """
      Apply deltas to shift/scale base boxes.
  
      Typically the rois are anchor or proposed bounding boxes and the deltas are
      network outputs used to shift/scale those boxes.
  
      Args:
          rois (Tensor): boxes to be transformed. Has shape (N, 4)
          deltas (Tensor): encoded offsets with respect to each roi.
              Has shape (N, 6). Note N = num_anchors * W * H when rois is a grid
              of anchors. Offset encoding follows [1]_.
          means (list): denormalizing means for delta coordinates
          stds (list): denormalizing standard deviation for delta coordinates
          max_shape (tuple[int, int]): maximum bounds for boxes. specifies (H, W)
          wh_ratio_clip (float): maximum aspect ratio for boxes.
  
      Returns:
          Tensor: boxes with shape (N, 4), where columns represent
              tl_x, tl_y, br_x, br_y.
  
      References:
          .. [1] https://arxiv.org/abs/1311.2524
      """$SEP$# Compute center of each roi$SEP$# Use exp(network energy) to enlarge/shrink each roi$SEP$# Use network energy to shift the center of each roi$SEP$# gx = px + pr * dx$SEP$# gy = py + ph * dy$SEP$# gz = pz + pd * dz$SEP$# Convert center-xy/width/height to top-left, bottom-right