docstr: Initialize the weights in the module.
  
  Args:
      pretrained (str, optional): Path to pre-trained weights.
          Defaults to None.
docstr_tok: ["Initialize","the","weights","in","the","module",".","Args",":","pretrained","(","str",",","optional",")",":","Path","to","pre-trained","weights",".","Defaults","to","None","."]
code: def init_weights(self, pretrained=None):
      """Initialize the weights in the module.
  
      Args:
          pretrained (str, optional): Path to pre-trained weights.
              Defaults to None.
      """
      if isinstance(pretrained, str):
          logger = get_root_logger()
          load_checkpoint(self, pretrained, strict=False, logger=logger)
      elif pretrained is None:
          for m in self.modules():
              if isinstance(m, nn.Conv2d):
                  kaiming_init(m)
              elif isinstance(m, nn.BatchNorm2d):
                  constant_init(m, 1)
      else:
          raise TypeError("pretrained must be a str or None")
  
file_path: insightface/detection/scrfd/mmdet/models/roi_heads/shared_heads/res_layer.py
imports: import torch.nn
  from mmcv.cnn import constant_init, kaiming_init
  from mmcv.runner import auto_fp16, load_checkpoint
  from mmdet.models.backbones import ResNet
  from mmdet.models.builder import SHARED_HEADS
  from mmdet.models.utils import ResLayer
  from mmdet.utils import get_root_logger
label_desc: Use image node_id 2 for calling the ResLayer obj's underlying member method code with example usage: obj.init_weights(pretrained) without return types