class_docstr: The PPMattingV2 implementation based on PaddlePaddle.
  
  The original article refers to
  TODO Guowei Chen, et, al. "" ().
  
  Args:
      backbone: backobne model.
      pretrained(str, optional): The path of pretrianed model. Defautl: None.
      dpp_len_trans(int, optional): The depth of transformer block in dpp(DoublePyramidPoolModule). Default: 1.
      dpp_index(list, optional): The index of backone output which as the input in dpp. Default: [1, 2, 3, 4].
      dpp_mid_channel(int, optional): The output channels of the first pyramid pool in dpp. Default: 256.
      dpp_out_channel(int, optional): The output channels of dpp. Default: 512.
      dpp_bin_sizes(list, optional): The output size of the second pyramid pool in dpp. Default: (2, 4, 6).
      dpp_mlp_ratios(int, optional): The expandsion ratio of mlp in dpp. Default: 2.
      dpp_attn_ratio(int, optional): The expandsion ratio of attention. Default: 2.
      dpp_merge_type(str, optional): The merge type of the output of the second pyramid pool in dpp, 
          which should be one of (`concat`, `add`). Default: 'concat'.
      mlff_merge_type(str, optional): The merge type of the multi features before output. 
          It should be one of ('add', 'concat'). Default: 'concat'.
class_docstr_tok: ["The","PPMattingV2","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","TODO","Guowei","Chen",",","et",",","al.","``","''","(",")",".","Args",":","backbone",":","backobne","model",".","pretrained","(","str",",","optional",")",":","The","path","of","pretrianed","model",".","Defautl",":","None",".","dpp_len_trans","(","int",",","optional",")",":","The","depth","of","transformer","block","in","dpp","(","DoublePyramidPoolModule",")",".","Default",":","1.","dpp_index","(","list",",","optional",")",":","The","index","of","backone","output","which","as","the","input","in","dpp",".","Default",":","[","1",",","2",",","3",",","4","]",".","dpp_mid_channel","(","int",",","optional",")",":","The","output","channels","of","the","first","pyramid","pool","in","dpp",".","Default",":","256.","dpp_out_channel","(","int",",","optional",")",":","The","output","channels","of","dpp",".","Default",":","512.","dpp_bin_sizes","(","list",",","optional",")",":","The","output","size","of","the","second","pyramid","pool","in","dpp",".","Default",":","(","2",",","4",",","6",")",".","dpp_mlp_ratios","(","int",",","optional",")",":","The","expandsion","ratio","of","mlp","in","dpp",".","Default",":","2.","dpp_attn_ratio","(","int",",","optional",")",":","The","expandsion","ratio","of","attention",".","Default",":","2.","dpp_merge_type","(","str",",","optional",")",":","The","merge","type","of","the","output","of","the","second","pyramid","pool","in","dpp",",","which","should","be","one","of","(","`","concat","`",",","`","add","`",")",".","Default",":","'concat","'",".","mlff_merge_type","(","str",",","optional",")",":","The","merge","type","of","the","multi","features","before","output",".","It","should","be","one","of","(","'add","'",",","'concat","'",")",".","Default",":","'concat","'","."]
code: def forward(self, inputs):
      img = inputs["img"]
      input_shape = paddle.shape(img)
      feats_backbone = self.backbone(
          img
      )  # stdc1 [2x, 4x, 8x, 16x, 32x] [32, 64, 256, 512, 1024]
      x = self.dpp([feats_backbone[i] for i in self.dpp_index])
      dpp_out = x
  
      input_32x = [feats_backbone[-1], x]
      x = self.mlff32x(
          input_32x, paddle.shape(feats_backbone[-1])[-2:]
      )  # 32x
  
      input_16x = [feats_backbone[-2], x, dpp_out]
      x = self.mlff16x(
          input_16x, paddle.shape(feats_backbone[-2])[-2:]
      )  # 16x
  
      input_8x = [feats_backbone[-3], x, dpp_out]
      x = self.mlff8x(
          input_8x, paddle.shape(feats_backbone[-3])[-2:]
      )  # 8x
      mlff8x_output = x
  
      input_4x = [feats_backbone[-4], x]
      input_4x.append(
          F.interpolate(img, feats_backbone[-4].shape[2:], mode="area")
      )
      x = self.mlff4x(
          input_4x, paddle.shape(feats_backbone[-4])[-2:]
      )  # 4x
  
      input_2x = [feats_backbone[-5], x]
      input_2x.append(
          F.interpolate(img, feats_backbone[-5].shape[2:], mode="area")
      )
      x = self.mlff2x(
          input_2x, paddle.shape(feats_backbone[-5])[-2:]
      )  # 2x
  
      x = F.interpolate(
          x, input_shape[-2:], mode="bilinear", align_corners=False
      )
      x = paddle.concat([x, img], axis=1)
      alpha = self.matting_head_mlff2x(x)
  
      if self.training:
          logit_dict = {}
          logit_dict["alpha"] = alpha
          logit_dict["alpha_8x"] = self.matting_head_mlff8x(
              mlff8x_output
          )
  
          loss_dict = self.loss(logit_dict, inputs)
  
          return logit_dict, loss_dict
      else:
          return alpha
  
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 PPMattingV2 obj's underlying member method code with example usage: obj.forward(inputs) and returns: logit_dict,  loss_dict, alpha