code: def __init__(
      self,
      num_heads,
      ff_dim,
      num_enc_layers,
      conv_dim,
      mask_dim,
      in_feat_strides,
      in_feat_chns,
      feat_indices,
      common_stride,
  ):
      super().__init__()
  
      self.feature_strides = in_feat_strides
      self.feature_channels = in_feat_chns
      self.transformer_indices = feat_indices
      self.transformer_strides = [
          self.feature_strides[i] for i in self.transformer_indices
      ]
      self.transformer_channels = [
          self.feature_channels[i] for i in self.transformer_indices
      ]
  
      self.num_feature_levels = len(self.transformer_indices)
      input_proj_list = []
      # From low resolution to high resolution (res5 -> res2)
      for in_channels in self.transformer_channels[::-1]:
          input_proj_list.append(
              nn.Sequential(
                  nn.Conv2D(in_channels, conv_dim, kernel_size=1),
                  nn.GroupNorm(num_channels=conv_dim, num_groups=32),
              )
          )
      self.input_proj = nn.LayerList(input_proj_list)
  
      for proj in self.input_proj:
          # Note that we do not set gain=1 here, which differs from the original impl
          param_init.xavier_uniform(proj[0].weight)
          param_init.constant_init(proj[0].bias, value=0)
  
      self.transformer = MSDeformAttnTransformerEncoderOnly(
          embed_dim=conv_dim,
          dropout=0.0,
          num_heads=num_heads,
          ff_dim=ff_dim,
          num_encoder_layers=num_enc_layers,
          num_feature_levels=self.num_feature_levels,
      )
      num_steps = conv_dim // 2
      self.pe_layer = PositionEmbeddingSine(num_steps, normalize=True)
  
      self.mask_dim = mask_dim
      # Use 1x1 conv instead
      self.mask_conv = Conv2D(
          conv_dim,
          mask_dim,
          kernel_size=1,
          stride=1,
          padding=0,
      )
      c2_xavier_fill(self.mask_conv)
  
      self.maskformer_num_feature_levels = 3  # always use 3 scales
      self.common_stride = common_stride
  
      # Extra fpn levels
      stride = min(self.transformer_strides)
      self.num_fpn_levels = int(
          np.log2(stride) - np.log2(self.common_stride)
      )
  
      lateral_convs = []
      output_convs = []
  
      for idx, in_channels in enumerate(
          self.feature_channels[: self.num_fpn_levels]
      ):
          lateral_norm = nn.GroupNorm(
              num_channels=conv_dim, num_groups=32
          )
          output_norm = nn.GroupNorm(
              num_channels=conv_dim, num_groups=32
          )
  
          lateral_conv = Conv2D(
              in_channels,
              conv_dim,
              kernel_size=1,
              bias_attr=False,
              norm=lateral_norm,
          )
          output_conv = Conv2D(
              conv_dim,
              conv_dim,
              kernel_size=3,
              stride=1,
              padding=1,
              bias_attr=False,
              norm=output_norm,
              activation=nn.ReLU(),
          )
          c2_xavier_fill(lateral_conv)
          c2_xavier_fill(output_conv)
  
          self.add_sublayer("adapter_{}".format(idx + 1), lateral_conv)
          self.add_sublayer("layer_{}".format(idx + 1), output_conv)
  
          lateral_convs.append(lateral_conv)
          output_convs.append(output_conv)
  
      # Place convs into top-down order (from low to high resolution)
      # to make the top-down computation in forward clearer.
      self.lateral_convs = lateral_convs[::-1]
      self.output_convs = output_convs[::-1]
  
imports: import copy
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import param_init
  from paddlepanseg.models.param_init import c2_xavier_fill, THLinearInitMixin
  from .common import Conv2D, PositionEmbeddingSine
  from ._ms_deform_attn import MSDeformAttn
label_desc: Use image node_id 1 to create a new MSDeformAttnPixelDecoder object from inherited base classes: nn with example: obj = MSDeformAttnPixelDecoder(num_heads, ff_dim, num_enc_layers, conv_dim, mask_dim, in_feat_strides, in_feat_chns, feat_indices, common_stride)