code: def forward(self, srcs, pos_embeds):
      masks = [
          paddle.zeros(
              (x.shape[0], x.shape[2], x.shape[3]), dtype="bool"
          )
          for x in srcs
      ]
      # Prepare input for encoder
      src_flatten = []
      mask_flatten = []
      lvl_pos_embed_flatten = []
      spatial_shapes = []
      for lvl, (src, mask, pos_embed) in enumerate(
          zip(srcs, masks, pos_embeds)
      ):
          bs, c, h, w = src.shape
          spatial_shape = (h, w)
          spatial_shapes.append(spatial_shape)
          src = src.flatten(2).transpose((0, 2, 1))
          mask = mask.reshape((mask.shape[0], -1))
          pos_embed = pos_embed.flatten(2).transpose((0, 2, 1))
          lvl_pos_embed = pos_embed + self.level_embed[lvl].reshape(
              (1, 1, -1)
          )
          lvl_pos_embed_flatten.append(lvl_pos_embed)
          src_flatten.append(src)
          mask_flatten.append(mask)
      src_flatten = paddle.concat(src_flatten, 1)
      mask_flatten = paddle.concat(mask_flatten, 1)
      lvl_pos_embed_flatten = paddle.concat(lvl_pos_embed_flatten, 1)
      spatial_shapes = paddle.to_tensor(spatial_shapes, dtype="int64")
      level_start_index = paddle.concat(
          (
              paddle.zeros((1,), dtype="int64"),
              spatial_shapes.prod(1).cumsum(0)[:-1],
          )
      ).astype("int64")
      valid_ratios = paddle.stack(
          [self.get_valid_ratio(m) for m in masks], 1
      )
  
      # Encoder
      memory = self.encoder(
          src_flatten,
          spatial_shapes,
          level_start_index,
          valid_ratios,
          lvl_pos_embed_flatten,
          mask_flatten,
      )
  
      return memory, spatial_shapes, level_start_index
  
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 4 for calling the MSDeformAttnTransformerEncoderOnly obj's underlying member method code with example usage: obj.forward(srcs, pos_embeds) and returns: memory,  spatial_shapes,  level_start_index