code: def _get_decoder_input(
      self,
      memory,
      spatial_shapes,
      denoising_class=None,
      denoising_bbox_unact=None,
      is_teacher=False,
  ):
      bs, _, _ = memory.shape
      # prepare input for decoder
      if self.training or self.eval_size is None or is_teacher:
          anchors, valid_mask = self._generate_anchors(spatial_shapes)
      else:
          anchors, valid_mask = self.anchors, self.valid_mask
      memory = paddle.where(valid_mask, memory, paddle.to_tensor(0.0))
      output_memory = self.enc_output(memory)
  
      enc_outputs_class = self.enc_score_head(output_memory)
      enc_outputs_coord_unact = (
          self.enc_bbox_head(output_memory) + anchors
      )
  
      _, topk_ind = paddle.topk(
          enc_outputs_class.max(-1), self.num_queries, axis=1
      )
      # extract region proposal boxes
      batch_ind = paddle.arange(end=bs, dtype=topk_ind.dtype)
      batch_ind = batch_ind.unsqueeze(-1).tile([1, self.num_queries])
      topk_ind = paddle.stack([batch_ind, topk_ind], axis=-1)
  
      reference_points_unact = paddle.gather_nd(
          enc_outputs_coord_unact, topk_ind
      )  # unsigmoided.
      enc_topk_bboxes = F.sigmoid(reference_points_unact)
      if denoising_bbox_unact is not None:
          reference_points_unact = paddle.concat(
              [denoising_bbox_unact, reference_points_unact], 1
          )
      if self.training:
          reference_points_unact = reference_points_unact.detach()
      enc_topk_logits = paddle.gather_nd(enc_outputs_class, topk_ind)
  
      # extract region features
      if self.learnt_init_query:
          target = self.tgt_embed.weight.unsqueeze(0).tile([bs, 1, 1])
      else:
          target = paddle.gather_nd(output_memory, topk_ind)
          if self.training:
              target = target.detach()
      if denoising_class is not None:
          target = paddle.concat([denoising_class, target], 1)
  
      return (
          target,
          reference_points_unact,
          enc_topk_bboxes,
          enc_topk_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 8 for calling the RTDETRTransformer obj's underlying member method code with example usage: obj._get_decoder_input(memory, spatial_shapes, denoising_class, denoising_bbox_unact, is_teacher) and returns: target,  reference_points_unact,  enc_topk_bboxes,  enc_topk_logits