code: def __init__(self, config, **kwargs):
      global ALIGN_CORNERS
      extra = config.MODEL.EXTRA
      super(HighResolutionNet, self).__init__()
      ALIGN_CORNERS = config.MODEL.ALIGN_CORNERS
  
      # stem net
      self.conv1 = nn.Conv2d(
          3, 64, kernel_size=3, stride=2, padding=1, bias=False
      )
      self.bn1 = BatchNorm2d(64, momentum=BN_MOMENTUM)
      self.conv2 = nn.Conv2d(
          64, 64, kernel_size=3, stride=2, padding=1, bias=False
      )
      self.bn2 = BatchNorm2d(64, momentum=BN_MOMENTUM)
      self.relu = nn.ReLU(inplace=relu_inplace)
  
      self.stage1_cfg = extra["STAGE1"]
      num_channels = self.stage1_cfg["NUM_CHANNELS"][0]
      block = blocks_dict[self.stage1_cfg["BLOCK"]]
      num_blocks = self.stage1_cfg["NUM_BLOCKS"][0]
      self.layer1 = self._make_layer(
          block, 64, num_channels, num_blocks
      )
      stage1_out_channel = block.expansion * num_channels
  
      self.stage2_cfg = extra["STAGE2"]
      num_channels = self.stage2_cfg["NUM_CHANNELS"]
      block = blocks_dict[self.stage2_cfg["BLOCK"]]
      num_channels = [
          num_channels[i] * block.expansion
          for i in range(len(num_channels))
      ]
      self.transition1 = self._make_transition_layer(
          [stage1_out_channel], num_channels
      )
      self.stage2, pre_stage_channels = self._make_stage(
          self.stage2_cfg, num_channels
      )
  
      self.stage3_cfg = extra["STAGE3"]
      num_channels = self.stage3_cfg["NUM_CHANNELS"]
      block = blocks_dict[self.stage3_cfg["BLOCK"]]
      num_channels = [
          num_channels[i] * block.expansion
          for i in range(len(num_channels))
      ]
      self.transition2 = self._make_transition_layer(
          pre_stage_channels, num_channels
      )
      self.stage3, pre_stage_channels = self._make_stage(
          self.stage3_cfg, num_channels
      )
  
      self.stage4_cfg = extra["STAGE4"]
      num_channels = self.stage4_cfg["NUM_CHANNELS"]
      block = blocks_dict[self.stage4_cfg["BLOCK"]]
      num_channels = [
          num_channels[i] * block.expansion
          for i in range(len(num_channels))
      ]
      self.transition3 = self._make_transition_layer(
          pre_stage_channels, num_channels
      )
      self.stage4, pre_stage_channels = self._make_stage(
          self.stage4_cfg, num_channels, multi_scale_output=True
      )
  
      last_inp_channels = np.int(np.sum(pre_stage_channels))
      ocr_mid_channels = config.MODEL.OCR.MID_CHANNELS
      ocr_key_channels = config.MODEL.OCR.KEY_CHANNELS
  
      self.conv3x3_ocr = nn.Sequential(
          nn.Conv2d(
              last_inp_channels,
              ocr_mid_channels,
              kernel_size=3,
              stride=1,
              padding=1,
          ),
          BatchNorm2d(ocr_mid_channels),
          nn.ReLU(inplace=relu_inplace),
      )
      self.ocr_gather_head = SpatialGather_Module(
          config.DATASET.NUM_CLASSES
      )
  
      self.ocr_distri_head = SpatialOCR_Module(
          in_channels=ocr_mid_channels,
          key_channels=ocr_key_channels,
          out_channels=ocr_mid_channels,
          scale=1,
          dropout=0.05,
      )
      self.cls_head = nn.Conv2d(
          ocr_mid_channels,
          config.DATASET.NUM_CLASSES,
          kernel_size=1,
          stride=1,
          padding=0,
          bias=True,
      )
  
      self.aux_head = nn.Sequential(
          nn.Conv2d(
              last_inp_channels,
              last_inp_channels,
              kernel_size=1,
              stride=1,
              padding=0,
          ),
          BatchNorm2d(last_inp_channels),
          nn.ReLU(inplace=relu_inplace),
          nn.Conv2d(
              last_inp_channels,
              config.DATASET.NUM_CLASSES,
              kernel_size=1,
              stride=1,
              padding=0,
              bias=True,
          ),
      )
  
imports: import os
  import logging
  import numpy
  import torch
  import torch.nn
  import torch._utils
  import torch.nn.functional
  from .bn_helper import BatchNorm2d, BatchNorm2d_class, relu_inplace
label_desc: Use image node_id 1 to create a new HighResolutionNet object from inherited base classes: nn with example: obj = HighResolutionNet(config)