class_docstr: The head implementation of HamNet based on PaddlePaddle.
  The original article refers to Zhengyang Geng, et al. "Is Attention Better Than Matrix Decomposition?"
  (https://arxiv.org/abs/2109.04553.pdf)
  
  Args:
      in_channels (list[int]): The feature channels from backbone.
      num_classes (int): The unique number of target classes.
      channels (int, optional): The intermediate channel of LightHamHead. Default: 256.
      dropout_rate (float, optional): The rate of dropout. Default: 0.1.
      align_corners (bool, optional): Whether use align_corners when interpolating. Default: False.
      ham_channels (int, optional): Input channel of Hamburger. Default: 512.
      num_groups (int, optional): The num_groups of convolutions in LightHamHead. Default: 32.
      ham_kwargs (dict, optional): Keyword arguments of Hamburger module.
class_docstr_tok: ["The","head","implementation","of","HamNet","based","on","PaddlePaddle",".","The","original","article","refers","to","Zhengyang","Geng",",","et","al",".","``","Is","Attention","Better","Than","Matrix","Decomposition","?","''","(","https",":","\/\/arxiv.org\/abs\/2109.04553.pdf",")","Args",":","in_channels","(","list","[","int","]",")",":","The","feature","channels","from","backbone",".","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","channels","(","int",",","optional",")",":","The","intermediate","channel","of","LightHamHead",".","Default",":","256.","dropout_rate","(","float",",","optional",")",":","The","rate","of","dropout",".","Default",":","0.1.","align_corners","(","bool",",","optional",")",":","Whether","use","align_corners","when","interpolating",".","Default",":","False",".","ham_channels","(","int",",","optional",")",":","Input","channel","of","Hamburger",".","Default",":","512.","num_groups","(","int",",","optional",")",":","The","num_groups","of","convolutions","in","LightHamHead",".","Default",":","32.","ham_kwargs","(","dict",",","optional",")",":","Keyword","arguments","of","Hamburger","module","."]
code: def __init__(
      self,
      in_channels,
      num_classes,
      channels=256,
      dropout_rate=0.1,
      align_corners=False,
      ham_channels=512,
      num_groups=32,
      ham_kwargs=None,
  ):
      super().__init__()
  
      if len(in_channels) != 3:
          raise ValueError(
              "The length of `in_channels` must be 3, but got {}".format(
                  len(in_channels)
              )
          )
  
      self.align_corners = align_corners
  
      self.squeeze = ConvGNAct(
          sum(in_channels),
          ham_channels,
          kernel_size=1,
          num_groups=num_groups,
          act_type="relu",
          bias_attr=False,
      )
  
      self.hamburger = Hamburger(ham_channels, num_groups, ham_kwargs)
  
      self.align = ConvGNAct(
          ham_channels,
          channels,
          kernel_size=1,
          num_groups=num_groups,
          act_type="relu",
          bias_attr=False,
      )
  
      self.dropout = (
          nn.Dropout2D(dropout_rate)
          if dropout_rate > 0.0
          else nn.Identity()
      )
      self.conv_seg = nn.Conv2D(channels, num_classes, kernel_size=1)
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
  from paddleseg.models.backbones.mscan import MSCAN
  from paddleseg.models.layers import NMF2D, ConvGNAct
  from paddleseg.utils import utils
label_desc: Use image node_id 1 to create a new LightHamHead object from inherited base classes: nn with example: obj = LightHamHead(in_channels, num_classes, channels, dropout_rate, align_corners, ham_channels, num_groups, ham_kwargs)