code: def bbox_rescale(bboxes: Tensor, scale_factor: float = 1.0) -> Tensor:
      """Rescale bounding box w.r.t. scale_factor.
  
      Args:
          bboxes (Tensor): Shape (n, 4) for bboxes or (n, 5) for rois
          scale_factor (float): rescale factor
  
      Returns:
          Tensor: Rescaled bboxes.
      """
      if bboxes.size(1) == 5:
          bboxes_ = bboxes[:, 1:]
          inds_ = bboxes[:, 0]
      else:
          bboxes_ = bboxes
      cx = (bboxes_[:, 0] + bboxes_[:, 2]) * 0.5
      cy = (bboxes_[:, 1] + bboxes_[:, 3]) * 0.5
      w = bboxes_[:, 2] - bboxes_[:, 0]
      h = bboxes_[:, 3] - bboxes_[:, 1]
      w = w * scale_factor
      h = h * scale_factor
      x1 = cx - 0.5 * w
      x2 = cx + 0.5 * w
      y1 = cy - 0.5 * h
      y2 = cy + 0.5 * h
      if bboxes.size(1) == 5:
          rescaled_bboxes = torch.stack([inds_, x1, y1, x2, y2], dim=-1)
      else:
          rescaled_bboxes = torch.stack([x1, y1, x2, y2], dim=-1)
      return rescaled_bboxes
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from mmdet.structures.bbox import BaseBoxes
label_desc: Use image node_id 10 for calling a global function with example usage: bbox_rescale(bboxes, scale_factor) and returns: rescaled_bboxes