class_docstr: The Token Pyramid Transformer(TopFormer) implementation based on PaddlePaddle.
  
  The original article refers to
  Zhang, Wenqiang, Zilong Huang, Guozhong Luo, Tao Chen, Xinggang Wang, Wenyu Liu, Gang Yu,
  and Chunhua Shen. "TopFormer: Token Pyramid Transformer for Mobile Semantic Segmentation." 
  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition,
  pp. 12083-12093. 2022.
  
  This model refers to https://github.com/hustvl/TopFormer.
  
  Args:
      num_classes(int,optional): The unique number of target classes.
      backbone(nn.Layer): Backbone network.
      head_use_dw (bool, optional): Whether the head use depthwise convolutions. Default: False.
      align_corners (bool, optional): Set the align_corners in resizing. Default: False.
      pretrained (str, optional): The path or url of pretrained model. Default: None.
class_docstr_tok: ["The","Token","Pyramid","Transformer","(","TopFormer",")","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","Zhang",",","Wenqiang",",","Zilong","Huang",",","Guozhong","Luo",",","Tao","Chen",",","Xinggang","Wang",",","Wenyu","Liu",",","Gang","Yu",",","and","Chunhua","Shen",".","``","TopFormer",":","Token","Pyramid","Transformer","for","Mobile","Semantic","Segmentation",".","''","In","Proceedings","of","the","IEEE\/CVF","Conference","on","Computer","Vision","and","Pattern","Recognition",",","pp",".","12083-12093",".","2022",".","This","model","refers","to","https",":","\/\/github.com\/hustvl\/TopFormer",".","Args",":","num_classes","(","int",",","optional",")",":","The","unique","number","of","target","classes",".","backbone","(","nn.Layer",")",":","Backbone","network",".","head_use_dw","(","bool",",","optional",")",":","Whether","the","head","use","depthwise","convolutions",".","Default",":","False",".","align_corners","(","bool",",","optional",")",":","Set","the","align_corners","in","resizing",".","Default",":","False",".","pretrained","(","str",",","optional",")",":","The","path","or","url","of","pretrained","model",".","Default",":","None","."]
code: def __init__(
      self,
      num_classes,
      backbone,
      head_use_dw=False,
      align_corners=False,
      pretrained=None,
  ):
      super().__init__()
      self.backbone = backbone
  
      head_in_channels = [
          i for i in backbone.injection_out_channels if i is not None
      ]
      self.decode_head = TopFormerHead(
          num_classes=num_classes,
          in_channels=head_in_channels,
          use_dw=head_use_dw,
          align_corners=align_corners,
      )
  
      self.align_corners = align_corners
      self.pretrained = pretrained
      self.init_weight()
  
file_path: PaddleSeg/paddleseg/models/topformer.py
imports: import warnings
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
  from paddleseg.utils import utils
  from paddleseg.models.backbones.top_transformer import ConvBNAct
label_desc: Use image node_id 1 to create a new TopFormer object from inherited base classes: nn with example: obj = TopFormer(num_classes, backbone, head_use_dw, align_corners, pretrained)