code: def forward(self, src_feats, src_mask=None, *args, **kwargs):
      srcs = []
      for i in range(len(src_feats)):
          srcs.append(self.input_proj[i](src_feats[i]))
      if self.num_feature_levels > len(srcs):
          len_srcs = len(srcs)
          for i in range(len_srcs, self.num_feature_levels):
              if i == len_srcs:
                  srcs.append(self.input_proj[i](src_feats[-1]))
              else:
                  srcs.append(self.input_proj[i](srcs[-1]))
      src_flatten = []
      mask_flatten = []
      lvl_pos_embed_flatten = []
      spatial_shapes = []
      valid_ratios = []
      for level, src in enumerate(srcs):
          src_shape = paddle.shape(src)
          bs = src_shape[0:1]
          h = src_shape[2:3]
          w = src_shape[3:4]
          spatial_shapes.append(paddle.concat([h, w]))
          src = src.flatten(2).transpose([0, 2, 1])
          src_flatten.append(src)
          if src_mask is not None:
              mask = F.interpolate(src_mask.unsqueeze(0), size=(h, w))[
                  0
              ]
          else:
              mask = paddle.ones([bs, h, w])
          valid_ratios.append(get_valid_ratio(mask))
          pos_embed = self.position_embedding(mask).flatten(1, 2)
          lvl_pos_embed = pos_embed + self.level_embed.weight[level]
          lvl_pos_embed_flatten.append(lvl_pos_embed)
          mask = mask.flatten(1)
          mask_flatten.append(mask)
      src_flatten = paddle.concat(src_flatten, 1)
      mask_flatten = (
          None if src_mask is None else paddle.concat(mask_flatten, 1)
      )
      lvl_pos_embed_flatten = paddle.concat(lvl_pos_embed_flatten, 1)
      # [l, 2]
      spatial_shapes = paddle.to_tensor(
          paddle.stack(spatial_shapes).astype("int64")
      )
      # [l], 每一个level的起始index
      level_start_index = paddle.concat(
          [
              paddle.zeros([1], dtype="int64"),
              spatial_shapes.prod(1).cumsum(0)[:-1],
          ]
      )
      # [b, l, 2]
      valid_ratios = paddle.stack(valid_ratios, 1)
  
      # encoder
      memory = self.encoder(
          src_flatten,
          spatial_shapes,
          level_start_index,
          mask_flatten,
          lvl_pos_embed_flatten,
          valid_ratios,
      )
  
      # prepare input for decoder
      bs, _, c = memory.shape
      query_embed = self.query_pos_embed.weight.unsqueeze(0).tile(
          [bs, 1, 1]
      )
      tgt = self.tgt_embed.weight.unsqueeze(0).tile([bs, 1, 1])
      reference_points = F.sigmoid(self.reference_points(query_embed))
      reference_points_input = reference_points.unsqueeze(
          2
      ) * valid_ratios.unsqueeze(1)
  
      # decoder
      hs = self.decoder(
          tgt,
          reference_points_input,
          memory,
          spatial_shapes,
          level_start_index,
          mask_flatten,
          query_embed,
      )
  
      return (hs, memory, reference_points)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from ppdet.core.workspace import register
  from ..layers import MultiHeadAttention
  from .position_encoding import PositionEmbedding
  from .utils import _get_clones, get_valid_ratio
  from ..initializer import linear_init_, constant_, xavier_uniform_, normal_
label_desc: Use image node_id 4 for calling the DeformableTransformer obj's underlying member method code with example usage: obj.forward(src_feats, src_mask) and returns: hs,  memory,  reference_points