class_docstr: The RTFormer implementation based on PaddlePaddle.
  
  The original article refers to "Wang, Jian, Chenhui Gou, Qiman Wu, Haocheng Feng, 
  Junyu Han, Errui Ding, and Jingdong Wang. RTFormer: Efficient Design for Real-Time
  Semantic Segmentation with Transformer. arXiv preprint arXiv:2210.07124 (2022)."
  
  Args:
      num_classes (int): The unique number of target classes.
      layer_nums (List, optional): The layer nums of every stage. Default: [2, 2, 2, 2]
      base_channels (int, optional): The base channels. Default: 64
      spp_channels (int, optional): The channels of DAPPM. Defualt: 128
      num_heads (int, optional): The num of heads in EABlock. Default: 8
      head_channels (int, optional): The channels of head in EABlock. Default: 128
      drop_rate (float, optional): The drop rate in EABlock. Default:0.
      drop_path_rate (float, optional): The drop path rate in EABlock. Default: 0.2
      use_aux_head (bool, optional): Whether use auxiliary head. Default: True
      use_injection (list[boo], optional): Whether use injection in layer 4 and 5.
          Default: [True, True]
      lr_mult (float, optional): The multiplier of lr for DAPPM and head module. Default: 10
      cross_size (int, optional): The size of pooling in cross_kv. Default: 12
      in_channels (int, optional): The channels of input image. Default: 3
      pretrained (str, optional): The path or url of pretrained model. Default: None.
class_docstr_tok: ["The","RTFormer","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","``","Wang",",","Jian",",","Chenhui","Gou",",","Qiman","Wu",",","Haocheng","Feng",",","Junyu","Han",",","Errui","Ding",",","and","Jingdong","Wang",".","RTFormer",":","Efficient","Design","for","Real-Time","Semantic","Segmentation","with","Transformer",".","arXiv","preprint","arXiv:2210.07124","(","2022",")",".","''","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","layer_nums","(","List",",","optional",")",":","The","layer","nums","of","every","stage",".","Default",":","[","2",",","2",",","2",",","2","]","base_channels","(","int",",","optional",")",":","The","base","channels",".","Default",":","64","spp_channels","(","int",",","optional",")",":","The","channels","of","DAPPM",".","Defualt",":","128","num_heads","(","int",",","optional",")",":","The","num","of","heads","in","EABlock",".","Default",":","8","head_channels","(","int",",","optional",")",":","The","channels","of","head","in","EABlock",".","Default",":","128","drop_rate","(","float",",","optional",")",":","The","drop","rate","in","EABlock",".","Default:0.","drop_path_rate","(","float",",","optional",")",":","The","drop","path","rate","in","EABlock",".","Default",":","0.2","use_aux_head","(","bool",",","optional",")",":","Whether","use","auxiliary","head",".","Default",":","True","use_injection","(","list","[","boo","]",",","optional",")",":","Whether","use","injection","in","layer","4","and","5",".","Default",":","[","True",",","True","]","lr_mult","(","float",",","optional",")",":","The","multiplier","of","lr","for","DAPPM","and","head","module",".","Default",":","10","cross_size","(","int",",","optional",")",":","The","size","of","pooling","in","cross_kv",".","Default",":","12","in_channels","(","int",",","optional",")",":","The","channels","of","input","image",".","Default",":","3","pretrained","(","str",",","optional",")",":","The","path","or","url","of","pretrained","model",".","Default",":","None","."]
code: def forward(self, x):
      x1 = self.layer1(self.conv1(x))  # c, 1/4
      x2 = self.layer2(self.relu(x1))  # 2c, 1/8
      x3 = self.layer3(self.relu(x2))  # 4c, 1/16
      x3_ = x2 + F.interpolate(
          self.compression3(x3),
          size=paddle.shape(x2)[2:],
          mode="bilinear",
      )
      x3_ = self.layer3_(self.relu(x3_))  # 2c, 1/8
  
      x4_, x4 = self.layer4(
          [self.relu(x3_), self.relu(x3)]
      )  # 2c, 1/8; 8c, 1/16
      x5_, x5 = self.layer5(
          [self.relu(x4_), self.relu(x4)]
      )  # 2c, 1/8; 8c, 1/32
  
      x6 = self.spp(x5)
      x6 = F.interpolate(
          x6, size=paddle.shape(x5_)[2:], mode="bilinear"
      )  # 2c, 1/8
      x_out = self.seghead(paddle.concat([x5_, x6], axis=1))  # 4c, 1/8
      logit_list = [x_out]
  
      if self.training and self.use_aux_head:
          x_out_extra = self.seghead_extra(x3_)
          logit_list.append(x_out_extra)
  
      logit_list = [
          F.interpolate(
              logit,
              paddle.shape(x)[2:],
              mode="bilinear",
              align_corners=False,
          )
          for logit in logit_list
      ]
  
      return logit_list
  
imports: from functools import partial
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
  from paddleseg.utils import utils
  from paddleseg.models.backbones.transformer_utils import DropPath, Identity
  from paddleseg.cvlibs.param_init import constant_init, kaiming_normal_init, trunc_normal_init
label_desc: Use image node_id 5 for calling the RTFormer obj's underlying member method code with example usage: obj.forward(x) and returns: logit_list