class_docstr: Extract global information through double pyramid pool structure and attention calculation by transformer block.
  
  Args:
      stride(int): The stride for the inputs.
      input_channel(int): The total channels of input features.
      mid_channel(int, optional): The output channels of the first pyramid pool. Default: 256.
      out_channel(int, optional): The output channels. Default: 512.
      len_trans(int, optional): The depth of transformer block. Default: 1.
      bin_sizes(list, optional): The output size of the second pyramid pool. Default: (2, 4, 6).
      mlp_ratios(int, optional): The expandsion ratio of the mlp. Default: 2.
      attn_ratio(int, optional): The expandsion ratio of the attention. Default: 2.
      merge_type(str, optional): The merge type of the output of the second pyramid pool, which should be one of (`concat`, `add`). Default: 'concat'.
      align_corners(bool, optional): Whether to use `align_corners` when interpolating. Default: False.
class_docstr_tok: ["Extract","global","information","through","double","pyramid","pool","structure","and","attention","calculation","by","transformer","block",".","Args",":","stride","(","int",")",":","The","stride","for","the","inputs",".","input_channel","(","int",")",":","The","total","channels","of","input","features",".","mid_channel","(","int",",","optional",")",":","The","output","channels","of","the","first","pyramid","pool",".","Default",":","256.","out_channel","(","int",",","optional",")",":","The","output","channels",".","Default",":","512.","len_trans","(","int",",","optional",")",":","The","depth","of","transformer","block",".","Default",":","1.","bin_sizes","(","list",",","optional",")",":","The","output","size","of","the","second","pyramid","pool",".","Default",":","(","2",",","4",",","6",")",".","mlp_ratios","(","int",",","optional",")",":","The","expandsion","ratio","of","the","mlp",".","Default",":","2.","attn_ratio","(","int",",","optional",")",":","The","expandsion","ratio","of","the","attention",".","Default",":","2.","merge_type","(","str",",","optional",")",":","The","merge","type","of","the","output","of","the","second","pyramid","pool",",","which","should","be","one","of","(","`","concat","`",",","`","add","`",")",".","Default",":","'concat","'",".","align_corners","(","bool",",","optional",")",":","Whether","to","use","`","align_corners","`","when","interpolating",".","Default",":","False","."]
code: def _make_stage(self, embdeding_channels, size, block_num):
      prior = nn.AdaptiveAvgPool2D(output_size=size)
      if size == 1:
          trans = layers.ConvBNReLU(
              in_channels=embdeding_channels,
              out_channels=embdeding_channels,
              kernel_size=1,
          )
      else:
          trans = BasicLayer(
              block_num=block_num,
              embedding_dim=embdeding_channels,
              key_dim=16,
              num_heads=8,
              mlp_ratios=self.mlp_rations,
              attn_ratio=self.attn_ratio,
              drop=0,
              attn_drop=0,
              drop_path=0,
              act_layer=nn.ReLU6,
              lr_mult=1.0,
          )
      return nn.Sequential(prior, trans)
  
imports: from functools import partial
  from collections import defaultdict
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddleseg
  from paddleseg import utils
  from paddleseg.models import layers
  from paddleseg.cvlibs import manager
  from paddleseg.models.backbones.transformer_utils import Identity, DropPath
  from ppmatting.models.layers import MLFF
  from ppmatting.models.losses import MRSD, GradientLoss
label_desc: Use image node_id 2 for calling the DoublePyramidPoolModule obj's underlying member method code with example usage: obj._make_stage(embdeding_channels, size, block_num) and returns: nn