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: Build RoI operator to extract feature from each level feature map.
  
  Args:
      layer_cfg (:obj:`ConfigDict` or dict): Dictionary to construct and
          config RoI layer operation. Options are modules under
          ``mmcv/ops`` such as ``RoIAlign``.
      featmap_strides (list[int]): The stride of input feature map w.r.t
          to the original image size, which would be used to scale RoI
          coordinate (original image coordinate system) to feature
          coordinate system.
  
  Returns:
      :obj:`nn.ModuleList`: The RoI extractor modules for each level
          feature map.
docstr_tok: ["Build","RoI","operator","to","extract","feature","from","each","level","feature","map",".","Args",":","layer_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Dictionary","to","construct","and","config","RoI","layer","operation",".","Options","are","modules","under","``","mmcv\/ops","``","such","as","``","RoIAlign","``",".","featmap_strides","(","list","[","int","]",")",":","The","stride","of","input","feature","map","w.r.t","to","the","original","image","size",",","which","would","be","used","to","scale","RoI","coordinate","(","original","image","coordinate","system",")","to","feature","coordinate","system",".","Returns",":",":","obj",":","`","nn.ModuleList","`",":","The","RoI","extractor","modules","for","each","level","feature","map","."]
code: def build_roi_layers(
      self, layer_cfg: ConfigType, featmap_strides: List[int]
  ) -> nn.ModuleList:
      """Build RoI operator to extract feature from each level feature map.
  
      Args:
          layer_cfg (:obj:`ConfigDict` or dict): Dictionary to construct and
              config RoI layer operation. Options are modules under
              ``mmcv/ops`` such as ``RoIAlign``.
          featmap_strides (list[int]): The stride of input feature map w.r.t
              to the original image size, which would be used to scale RoI
              coordinate (original image coordinate system) to feature
              coordinate system.
  
      Returns:
          :obj:`nn.ModuleList`: The RoI extractor modules for each level
              feature map.
      """
  
      cfg = layer_cfg.copy()
      layer_type = cfg.pop("type")
      assert hasattr(ops, layer_type)
      layer_cls = getattr(ops, layer_type)
      roi_layers = nn.ModuleList(
          [
              layer_cls(spatial_scale=1 / s, **cfg)
              for s in featmap_strides
          ]
      )
      return roi_layers
  
file_path: mmocr/projects/ABCNet/abcnet/model/base_roi_extractor.py
imports: from abc import ABCMeta, abstractmethod
  from typing import List, Tuple
  import torch.nn
  from mmcv import ops
  from mmengine.model import BaseModule
  from torch import Tensor
  from mmocr.utils import ConfigType, OptMultiConfig
label_desc: Use image node_id 3 for calling the BaseRoIExtractor obj's underlying member method code with example usage: obj.build_roi_layers(layer_cfg, featmap_strides) and returns: roi_layers