class_docstr: CGNet backbone.
  
  A Light-weight Context Guided Network for Semantic Segmentation
  arXiv: https://arxiv.org/abs/1811.08201
  
  Args:
      in_channels (int): Number of input image channels. Normally 3.
      num_channels (tuple[int]): Numbers of feature channels at each stages.
          Default: (32, 64, 128).
      num_blocks (tuple[int]): Numbers of CG blocks at stage 1 and stage 2.
          Default: (3, 21).
      dilations (tuple[int]): Dilation rate for surrounding context
          extractors at stage 1 and stage 2. Default: (2, 4).
      reductions (tuple[int]): Reductions for global context extractors at
          stage 1 and stage 2. Default: (8, 16).
      conv_cfg (dict): Config dict for convolution layer.
          Default: None, which means using conv2d.
      norm_cfg (dict): Config dict for normalization layer.
          Default: dict(type='BN', requires_grad=True).
      act_cfg (dict): Config dict for activation layer.
          Default: dict(type='PReLU').
      norm_eval (bool): Whether to set norm layers to eval mode, namely,
          freeze running stats (mean and var). Note: Effect on Batch Norm
          and its variants only. Default: False.
      with_cp (bool): Use checkpoint or not. Using checkpoint will save some
          memory while slowing down the training speed. Default: False.
class_docstr_tok: ["CGNet","backbone",".","A","Light-weight","Context","Guided","Network","for","Semantic","Segmentation","arXiv",":","https",":","\/\/arxiv.org\/abs\/1811.08201","Args",":","in_channels","(","int",")",":","Number","of","input","image","channels",".","Normally","3.","num_channels","(","tuple","[","int","]",")",":","Numbers","of","feature","channels","at","each","stages",".","Default",":","(","32",",","64",",","128",")",".","num_blocks","(","tuple","[","int","]",")",":","Numbers","of","CG","blocks","at","stage","1","and","stage","2",".","Default",":","(","3",",","21",")",".","dilations","(","tuple","[","int","]",")",":","Dilation","rate","for","surrounding","context","extractors","at","stage","1","and","stage","2",".","Default",":","(","2",",","4",")",".","reductions","(","tuple","[","int","]",")",":","Reductions","for","global","context","extractors","at","stage","1","and","stage","2",".","Default",":","(","8",",","16",")",".","conv_cfg","(","dict",")",":","Config","dict","for","convolution","layer",".","Default",":","None",",","which","means","using","conv2d",".","norm_cfg","(","dict",")",":","Config","dict","for","normalization","layer",".","Default",":","dict","(","type='BN","'",",","requires_grad=True",")",".","act_cfg","(","dict",")",":","Config","dict","for","activation","layer",".","Default",":","dict","(","type='PReLU","'",")",".","norm_eval","(","bool",")",":","Whether","to","set","norm","layers","to","eval","mode",",","namely",",","freeze","running","stats","(","mean","and","var",")",".","Note",":","Effect","on","Batch","Norm","and","its","variants","only",".","Default",":","False",".","with_cp","(","bool",")",":","Use","checkpoint","or","not",".","Using","checkpoint","will","save","some","memory","while","slowing","down","the","training","speed",".","Default",":","False","."]
docstr: Initialize the weights in backbone.
  
  Args:
      pretrained (str, optional): Path to pre-trained weights.
          Defaults to None.
docstr_tok: ["Initialize","the","weights","in","backbone",".","Args",":","pretrained","(","str",",","optional",")",":","Path","to","pre-trained","weights",".","Defaults","to","None","."]
code: def init_weights(self, pretrained=None):
      """Initialize the weights in backbone.
  
      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, nn.Linear)):
                  kaiming_init(m)
              elif isinstance(m, (_BatchNorm, nn.GroupNorm)):
                  constant_init(m, 1)
              elif isinstance(m, nn.PReLU):
                  constant_init(m, 0)
      else:
          raise TypeError("pretrained must be a str or None")
  
imports: import torch
  import torch.nn
  import torch.utils.checkpoint
  from annotator.uniformer.mmcv.cnn import ConvModule, build_conv_layer, build_norm_layer, constant_init, kaiming_init
  from annotator.uniformer.mmcv.runner import load_checkpoint
  from annotator.uniformer.mmcv.utils.parrots_wrapper import _BatchNorm
  from annotator.uniformer.mmseg.utils import get_root_logger
  from ..builder import BACKBONES
label_desc: Use image node_id 3 for calling the CGNet obj's underlying member method code with example usage: obj.init_weights(pretrained) without return types