code: def forward(
      self,
      tgt,
      ref_points_unact,
      memory,
      memory_spatial_shapes,
      memory_level_start_index,
      bbox_head,
      score_head,
      query_pos_head,
      attn_mask=None,
      memory_mask=None,
      query_pos_head_inv_sig=False,
  ):
      output = tgt
      dec_out_bboxes = []
      dec_out_logits = []
      ref_points_detach = F.sigmoid(ref_points_unact)
      for i, layer in enumerate(self.layers):
          ref_points_input = ref_points_detach.unsqueeze(2)
          if not query_pos_head_inv_sig:
              query_pos_embed = query_pos_head(ref_points_detach)
          else:
              query_pos_embed = query_pos_head(
                  inverse_sigmoid(ref_points_detach)
              )
  
          output = layer(
              output,
              ref_points_input,
              memory,
              memory_spatial_shapes,
              memory_level_start_index,
              attn_mask,
              memory_mask,
              query_pos_embed,
          )
  
          inter_ref_bbox = F.sigmoid(
              bbox_head[i](output) + inverse_sigmoid(ref_points_detach)
          )
  
          if self.training:
              dec_out_logits.append(score_head[i](output))
              if i == 0:
                  dec_out_bboxes.append(inter_ref_bbox)
              else:
                  dec_out_bboxes.append(
                      F.sigmoid(
                          bbox_head[i](output)
                          + inverse_sigmoid(ref_points)
                      )
                  )
          elif i == self.eval_idx:
              dec_out_logits.append(score_head[i](output))
              dec_out_bboxes.append(inter_ref_bbox)
              break
  
          ref_points = inter_ref_bbox
          ref_points_detach = (
              inter_ref_bbox.detach()
              if self.training
              else inter_ref_bbox
          )
  
      return paddle.stack(dec_out_bboxes), paddle.stack(dec_out_logits)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from ppdet.core.workspace import register
  from ..layers import MultiHeadAttention
  from ..heads.detr_head import MLP
  from .deformable_transformer import MSDeformableAttention
  from ..initializer import linear_init_, constant_, xavier_uniform_, normal_, bias_init_with_prob
  from .utils import _get_clones, get_sine_pos_embed, get_contrastive_denoising_training_group, inverse_sigmoid
label_desc: Use image node_id 2 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.forward(tgt, ref_points_unact, memory, memory_spatial_shapes, memory_level_start_index, bbox_head, score_head, query_pos_head, attn_mask, memory_mask, query_pos_head_inv_sig) and returns: paddle,  paddle