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 _make_layer(
      self, block, in_channels, out_channels, blocks, stride=1
  ):
      downsample = None
      if stride != 1 or in_channels != out_channels:
          downsample = nn.Sequential(
              conv2d(
                  in_channels,
                  out_channels,
                  kernel_size=1,
                  stride=stride,
              ),
              bn2d(out_channels),
          )
  
      layers = []
      layers.append(
          block(in_channels, out_channels, stride, downsample)
      )
      for i in range(1, blocks):
          if i == (blocks - 1):
              layers.append(
                  block(
                      out_channels, out_channels, stride=1, no_relu=True
                  )
              )
          else:
              layers.append(
                  block(
                      out_channels,
                      out_channels,
                      stride=1,
                      no_relu=False,
                  )
              )
  
      return nn.Sequential(*layers)
  
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 4 for calling the RTFormer obj's underlying member method code with example usage: obj._make_layer(block, in_channels, out_channels, blocks, stride) and returns: nn