class_docstr: Unified Perceptual Parsing for Scene Understanding. This head is the implementation of
  [UPerNet](https://arxiv.org/abs/1807.10221).
code: def __init__(self, config, in_channels):
      super().__init__()
  
      self.config = config
      self.pool_scales = config.pool_scales  # e.g. (1, 2, 3, 6)
      self.in_channels = in_channels
      self.channels = config.hidden_size
      self.align_corners = False
      self.classifier = nn.Conv2d(
          self.channels, config.num_labels, kernel_size=1
      )
  
      # PSP Module
      self.psp_modules = UperNetPyramidPoolingModule(
          self.pool_scales,
          self.in_channels[-1],
          self.channels,
          align_corners=self.align_corners,
      )
      self.bottleneck = UperNetConvModule(
          self.in_channels[-1] + len(self.pool_scales) * self.channels,
          self.channels,
          kernel_size=3,
          padding=1,
      )
      # FPN Module
      self.lateral_convs = nn.ModuleList()
      self.fpn_convs = nn.ModuleList()
      for in_channels in self.in_channels[:-1]:  # skip the top layer
          l_conv = UperNetConvModule(
              in_channels, self.channels, kernel_size=1
          )
          fpn_conv = UperNetConvModule(
              self.channels, self.channels, kernel_size=3, padding=1
          )
          self.lateral_convs.append(l_conv)
          self.fpn_convs.append(fpn_conv)
  
      self.fpn_bottleneck = UperNetConvModule(
          len(self.in_channels) * self.channels,
          self.channels,
          kernel_size=3,
          padding=1,
      )
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...None import AutoBackbone
  from ...modeling_outputs import SemanticSegmenterOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
  from .configuration_upernet import UperNetConfig
label_desc: Use image node_id 1 to create a new UperNetHead object from inherited base classes: nn with example: obj = UperNetHead(config, in_channels)