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","."]
code: def __init__(
      self,
      in_channels: int,
      stem_channels: List[int],
      block_cfgs: dict,
      arch_layers: List[int],
      arch_channels: List[int],
      strides: Union[List[int], List[Tuple]],
      out_indices: Optional[List[int]] = None,
      plugins: Optional[Dict] = None,
      init_cfg: Optional[Union[Dict, List[Dict]]] = [
          dict(type="Xavier", layer="Conv2d"),
          dict(type="Constant", val=1, layer="BatchNorm2d"),
      ],
  ):
      super().__init__(init_cfg=init_cfg)
      assert isinstance(in_channels, int)
      assert isinstance(stem_channels, int) or utils.is_type_list(
          stem_channels, int
      )
      assert utils.is_type_list(arch_layers, int)
      assert utils.is_type_list(arch_channels, int)
      assert utils.is_type_list(strides, tuple) or utils.is_type_list(
          strides, int
      )
      assert len(arch_layers) == len(arch_channels) == len(strides)
      assert out_indices is None or isinstance(
          out_indices, (list, tuple)
      )
  
      self.out_indices = out_indices
      self._make_stem_layer(in_channels, stem_channels)
      self.num_stages = len(arch_layers)
      self.use_plugins = False
      self.arch_channels = arch_channels
      self.res_layers = []
      if plugins is not None:
          self.plugin_ahead_names = []
          self.plugin_after_names = []
          self.use_plugins = True
      for i, num_blocks in enumerate(arch_layers):
          stride = strides[i]
          channel = arch_channels[i]
  
          if self.use_plugins:
              self._make_stage_plugins(plugins, stage_idx=i)
  
          res_layer = self._make_layer(
              block_cfgs=block_cfgs,
              inplanes=self.inplanes,
              planes=channel,
              blocks=num_blocks,
              stride=stride,
          )
          self.inplanes = channel
          layer_name = f"layer{i + 1}"
          self.add_module(layer_name, res_layer)
          self.res_layers.append(layer_name)
  
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 1 to create a new ResNet object from inherited base classes: BaseModule with example: obj = ResNet(in_channels, stem_channels, block_cfgs, arch_layers, arch_channels, strides, out_indices, plugins, init_cfg)