class_docstr: Base class for RoI extractor.
  
  Args:
      roi_layer (:obj:`ConfigDict` or dict): Specify RoI layer type and
          arguments.
      out_channels (int): Output channels of RoI layers.
      featmap_strides (list[int]): Strides of input feature maps.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict], optional): Initialization config dict. Defaults to None.
class_docstr_tok: ["Base","class","for","RoI","extractor",".","Args",":","roi_layer","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Specify","RoI","layer","type","and","arguments",".","out_channels","(","int",")",":","Output","channels","of","RoI","layers",".","featmap_strides","(","list","[","int","]",")",":","Strides","of","input","feature","maps",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None","."]
docstr: Scale RoI coordinates by scale factor.
  
  Args:
      rois (Tensor): RoI (Region of Interest), shape (n, 5)
      scale_factor (float): Scale factor that RoI will be multiplied by.
  
  Returns:
      Tensor: Scaled RoI.
docstr_tok: ["Scale","RoI","coordinates","by","scale","factor",".","Args",":","rois","(","Tensor",")",":","RoI","(","Region","of","Interest",")",",","shape","(","n",",","5",")","scale_factor","(","float",")",":","Scale","factor","that","RoI","will","be","multiplied","by",".","Returns",":","Tensor",":","Scaled","RoI","."]
code: def roi_rescale(self, rois: Tensor, scale_factor: float) -> Tensor:
      """Scale RoI coordinates by scale factor.
  
      Args:
          rois (Tensor): RoI (Region of Interest), shape (n, 5)
          scale_factor (float): Scale factor that RoI will be multiplied by.
  
      Returns:
          Tensor: Scaled RoI.
      """
  
      cx = (rois[:, 1] + rois[:, 3]) * 0.5
      cy = (rois[:, 2] + rois[:, 4]) * 0.5
      w = rois[:, 3] - rois[:, 1]
      h = rois[:, 4] - rois[:, 2]
      new_w = w * scale_factor
      new_h = h * scale_factor
      x1 = cx - new_w * 0.5
      x2 = cx + new_w * 0.5
      y1 = cy - new_h * 0.5
      y2 = cy + new_h * 0.5
      new_rois = torch.stack((rois[:, 0], x1, y1, x2, y2), dim=-1)
      return new_rois
  
file_path: mmdetection/mmdet/models/roi_heads/roi_extractors/base_roi_extractor.py
imports: from abc import ABCMeta, abstractmethod
  from typing import List, Optional, Tuple
  import torch
  import torch.nn
  from mmcv import ops
  from mmengine.model import BaseModule
  from torch import Tensor
  from mmdet.utils import ConfigType, OptMultiConfig
label_desc: Use image node_id 4 for calling the BaseRoIExtractor obj's underlying member method code with example usage: obj.roi_rescale(rois, scale_factor) and returns: new_rois