class_docstr: Context Guided Block for CGNet.
  
  This class consists of four components: local feature extractor,
  surrounding feature extractor, joint feature extractor and global
  context extractor.
  
  Args:
      in_channels (int): Number of input feature channels.
      out_channels (int): Number of output feature channels.
      dilation (int): Dilation rate for surrounding context extractor.
          Default: 2.
      reduction (int): Reduction for global context extractor. Default: 16.
      skip_connect (bool): Add input to output or not. Default: True.
      downsample (bool): Downsample the input to 1/2 or not. Default: False.
      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').
      with_cp (bool): Use checkpoint or not. Using checkpoint will save some
          memory while slowing down the training speed. Default: False.
class_docstr_tok: ["Context","Guided","Block","for","CGNet",".","This","class","consists","of","four","components",":","local","feature","extractor",",","surrounding","feature","extractor",",","joint","feature","extractor","and","global","context","extractor",".","Args",":","in_channels","(","int",")",":","Number","of","input","feature","channels",".","out_channels","(","int",")",":","Number","of","output","feature","channels",".","dilation","(","int",")",":","Dilation","rate","for","surrounding","context","extractor",".","Default",":","2.","reduction","(","int",")",":","Reduction","for","global","context","extractor",".","Default",":","16.","skip_connect","(","bool",")",":","Add","input","to","output","or","not",".","Default",":","True",".","downsample","(","bool",")",":","Downsample","the","input","to","1\/2","or","not",".","Default",":","False",".","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","'",")",".","with_cp","(","bool",")",":","Use","checkpoint","or","not",".","Using","checkpoint","will","save","some","memory","while","slowing","down","the","training","speed",".","Default",":","False","."]
code: def forward(self, x):
      def _inner_forward(x):
          out = self.conv1x1(x)
          loc = self.f_loc(out)
          sur = self.f_sur(out)
  
          joi_feat = torch.cat([loc, sur], 1)  # the joint feature
          joi_feat = self.bn(joi_feat)
          joi_feat = self.activate(joi_feat)
          if self.downsample:
              joi_feat = self.bottleneck(
                  joi_feat
              )  # channel = out_channels
          # f_glo is employed to refine the joint feature
          out = self.f_glo(joi_feat)
  
          if self.skip_connect:
              return x + out
          else:
              return out
  
      if self.with_cp and x.requires_grad:
          out = cp.checkpoint(_inner_forward, x)
      else:
          out = _inner_forward(x)
  
      return out
  
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 2 for calling the ContextGuidedBlock obj's underlying member method code with example usage: obj.forward(x) and returns: out, unknown, out