class_docstr: Args:
      in_channels (int): Number of channels of input image tensor.
      stem_channels (list[int]): List of channels in each stem layer. E.g.,
          [64, 128] stands for 64 and 128 channels in the first and second
          stem layers.
      block_cfgs (dict): Configs of block
      arch_layers (list[int]): List of Block number for each stage.
      arch_channels (list[int]): List of channels for each stage.
      strides (Sequence[int] or Sequence[tuple]): Strides of the first block
          of each stage.
      out_indices (Sequence[int], optional): Indices of output stages. If not
          specified, only the last stage will be returned.
      plugins (dict, optional): Configs of stage plugins
      init_cfg (dict or list[dict], optional): Initialization config dict.
class_docstr_tok: ["Args",":","in_channels","(","int",")",":","Number","of","channels","of","input","image","tensor",".","stem_channels","(","list","[","int","]",")",":","List","of","channels","in","each","stem","layer",".","E.g.",",","[","64",",","128","]","stands","for","64","and","128","channels","in","the","first","and","second","stem","layers",".","block_cfgs","(","dict",")",":","Configs","of","block","arch_layers","(","list","[","int","]",")",":","List","of","Block","number","for","each","stage",".","arch_channels","(","list","[","int","]",")",":","List","of","channels","for","each","stage",".","strides","(","Sequence","[","int","]","or","Sequence","[","tuple","]",")",":","Strides","of","the","first","block","of","each","stage",".","out_indices","(","Sequence","[","int","]",",","optional",")",":","Indices","of","output","stages",".","If","not","specified",",","only","the","last","stage","will","be","returned",".","plugins","(","dict",",","optional",")",":","Configs","of","stage","plugins","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict","."]
docstr: Make plugins for ResNet ``stage_idx``th stage.
  
  Currently we support inserting ``nn.Maxpooling``,
  ``mmcv.cnn.Convmodule``into the backbone. Originally designed
  for ResNet31-like architectures.
  
  Examples:
      >>> plugins=[
      ...     dict(cfg=dict(type="Maxpooling", arg=(2,2)),
      ...          stages=(True, True, False, False),
      ...          position='before_stage'),
      ...     dict(cfg=dict(type="Maxpooling", arg=(2,1)),
      ...          stages=(False, False, True, Flase),
      ...          position='before_stage'),
      ...     dict(cfg=dict(
      ...              type='ConvModule',
      ...              kernel_size=3,
      ...              stride=1,
      ...              padding=1,
      ...              norm_cfg=dict(type='BN'),
      ...              act_cfg=dict(type='ReLU')),
      ...          stages=(True, True, True, True),
      ...          position='after_stage')]
  
  Suppose ``stage_idx=1``, the structure of stage would be:
  
  .. code-block:: none
  
      Maxpooling -> A set of Basicblocks -> ConvModule
  
  Args:
      plugins (list[dict]): List of plugin configs to build.
      stage_idx (int): Index of stage to build
docstr_tok: ["Make","plugins","for","ResNet","``","stage_idx","``","th","stage",".","Currently","we","support","inserting","``","nn.Maxpooling","``",",","``","mmcv.cnn.Convmodule","``","into","the","backbone",".","Originally","designed","for","ResNet31-like","architectures",".","Examples",":",">",">",">","plugins=","[","...","dict","(","cfg=dict","(","type=","''","Maxpooling","''",",","arg=","(","2,2",")",")",",","...","stages=","(","True",",","True",",","False",",","False",")",",","...","position='before_stage","'",")",",","...","dict","(","cfg=dict","(","type=","''","Maxpooling","''",",","arg=","(","2,1",")",")",",","...","stages=","(","False",",","False",",","True",",","Flase",")",",","...","position='before_stage","'",")",",","...","dict","(","cfg=dict","(","...","type='ConvModule","'",",","...","kernel_size=3",",","...","stride=1",",","...","padding=1",",","...","norm_cfg=dict","(","type='BN","'",")",",","...","act_cfg=dict","(","type='ReLU","'",")",")",",","...","stages=","(","True",",","True",",","True",",","True",")",",","...","position='after_stage","'",")","]","Suppose","``","stage_idx=1","``",",","the","structure","of","stage","would","be",":","..","code-block",":",":","none","Maxpooling","-",">","A","set","of","Basicblocks","-",">","ConvModule","Args",":","plugins","(","list","[","dict","]",")",":","List","of","plugin","configs","to","build",".","stage_idx","(","int",")",":","Index","of","stage","to","build"]
code: def _make_stage_plugins(
      self, plugins: List[Dict], stage_idx: int
  ) -> None:
      """Make plugins for ResNet ``stage_idx``th stage.
  
      Currently we support inserting ``nn.Maxpooling``,
      ``mmcv.cnn.Convmodule``into the backbone. Originally designed
      for ResNet31-like architectures.
  
      Examples:
          >>> plugins=[
          ...     dict(cfg=dict(type="Maxpooling", arg=(2,2)),
          ...          stages=(True, True, False, False),
          ...          position='before_stage'),
          ...     dict(cfg=dict(type="Maxpooling", arg=(2,1)),
          ...          stages=(False, False, True, Flase),
          ...          position='before_stage'),
          ...     dict(cfg=dict(
          ...              type='ConvModule',
          ...              kernel_size=3,
          ...              stride=1,
          ...              padding=1,
          ...              norm_cfg=dict(type='BN'),
          ...              act_cfg=dict(type='ReLU')),
          ...          stages=(True, True, True, True),
          ...          position='after_stage')]
  
      Suppose ``stage_idx=1``, the structure of stage would be:
  
      .. code-block:: none
  
          Maxpooling -> A set of Basicblocks -> ConvModule
  
      Args:
          plugins (list[dict]): List of plugin configs to build.
          stage_idx (int): Index of stage to build
      """
      in_channels = self.arch_channels[stage_idx]
      self.plugin_ahead_names.append([])
      self.plugin_after_names.append([])
      for plugin in plugins:
          plugin = plugin.copy()
          stages = plugin.pop("stages", None)
          position = plugin.pop("position", None)
          assert stages is None or len(stages) == self.num_stages
          if stages[stage_idx]:
              if position == "before_stage":
                  name, layer = build_plugin_layer(
                      plugin["cfg"],
                      f"_before_stage_{stage_idx+1}",
                      in_channels=in_channels,
                      out_channels=in_channels,
                  )
                  self.plugin_ahead_names[stage_idx].append(name)
                  self.add_module(name, layer)
              elif position == "after_stage":
                  name, layer = build_plugin_layer(
                      plugin["cfg"],
                      f"_after_stage_{stage_idx+1}",
                      in_channels=in_channels,
                      out_channels=in_channels,
                  )
                  self.plugin_after_names[stage_idx].append(name)
                  self.add_module(name, layer)
              else:
                  raise ValueError("uncorrect plugin position")
  
file_path: mmocr/mmocr/models/textrecog/backbones/resnet.py
imports: from typing import Dict, List, Optional, Tuple, Union
  import torch
  from mmcv.cnn import ConvModule, build_plugin_layer
  from mmengine.model import BaseModule, Sequential
  import mmocr.utils
  from mmocr.models.textrecog.layers import BasicBlock
  from mmocr.registry import MODELS
label_desc: Use image node_id 4 for calling the ResNet obj's underlying member method code with example usage: obj._make_stage_plugins(plugins, stage_idx) without return types