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 forward(self, inputs):
      x = self.pp1(inputs)
      pp2_input = self.conv_mid(x)
  
      cat_layers = []
      for stage in self.pp2:
          x = stage(pp2_input)
          x = F.interpolate(
              x,
              paddle.shape(pp2_input)[2:],
              mode="bilinear",
              align_corners=self.align_corners,
          )
          cat_layers.append(x)
      cat_layers = [pp2_input] + cat_layers[::-1]
      if self.merge_type == "concat":
          cat = paddle.concat(cat_layers, axis=1)
      else:
          cat = sum(cat_layers)
      out = self.conv_out(cat)
      return out
  
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 3 for calling the DoublePyramidPoolModule obj's underlying member method code with example usage: obj.forward(inputs) and returns: out