code: def _get_decoder_input(
      self,
      memory,
      spatial_shapes,
      memory_mask=None,
      denoising_class=None,
      denoising_bbox=None,
  ):
      bs, _, _ = memory.shape
      # prepare input for decoder
      output_memory, output_anchors = self._get_encoder_output_anchors(
          memory, spatial_shapes, memory_mask
      )
      if self.dual_queries:
          enc_outputs_class = self.enc_score_head(output_memory[0])
          enc_outputs_coord_unact = (
              self.enc_bbox_head(output_memory[0]) + output_anchors
          )
      else:
          enc_outputs_class = self.enc_score_head(output_memory)
          enc_outputs_coord_unact = (
              self.enc_bbox_head(output_memory) + output_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)
      topk_coords_unact = paddle.gather_nd(
          enc_outputs_coord_unact, topk_ind
      )  # unsigmoided.
      enc_topk_bboxes = F.sigmoid(topk_coords_unact)
      reference_points = enc_topk_bboxes.detach()
      enc_topk_logits = paddle.gather_nd(enc_outputs_class, topk_ind)
  
      if self.dual_queries:
          enc_topk_logits_groups = []
          enc_topk_bboxes_groups = []
          reference_points_groups = []
          topk_ind_groups = []
          for g_id in range(self.dual_groups):
              enc_outputs_class_gid = self.enc_score_head_dq[g_id](
                  output_memory[g_id + 1]
              )
              enc_outputs_coord_unact_gid = (
                  self.enc_bbox_head_dq[g_id](output_memory[g_id + 1])
                  + output_anchors
              )
              _, topk_ind_gid = paddle.topk(
                  enc_outputs_class_gid.max(-1),
                  self.num_queries,
                  axis=1,
              )
              # extract region proposal boxes
              batch_ind = paddle.arange(
                  end=bs, dtype=topk_ind_gid.dtype
              )
              batch_ind = batch_ind.unsqueeze(-1).tile(
                  [1, self.num_queries]
              )
              topk_ind_gid = paddle.stack(
                  [batch_ind, topk_ind_gid], axis=-1
              )
              topk_coords_unact_gid = paddle.gather_nd(
                  enc_outputs_coord_unact_gid, topk_ind_gid
              )  # unsigmoided.
              enc_topk_bboxes_gid = F.sigmoid(topk_coords_unact_gid)
              reference_points_gid = enc_topk_bboxes_gid.detach()
              enc_topk_logits_gid = paddle.gather_nd(
                  enc_outputs_class_gid, topk_ind_gid
              )
  
              # append and combine
              topk_ind_groups.append(topk_ind_gid)
              enc_topk_logits_groups.append(enc_topk_logits_gid)
              enc_topk_bboxes_groups.append(enc_topk_bboxes_gid)
              reference_points_groups.append(reference_points_gid)
  
          enc_topk_bboxes = paddle.concat(
              [enc_topk_bboxes] + enc_topk_bboxes_groups, 1
          )
          enc_topk_logits = paddle.concat(
              [enc_topk_logits] + enc_topk_logits_groups, 1
          )
          reference_points = paddle.concat(
              [reference_points] + reference_points_groups, 1
          )
          topk_ind = paddle.concat([topk_ind] + topk_ind_groups, 1)
  
      # extract region features
      if self.learnt_init_query:
          target = self.tgt_embed.weight.unsqueeze(0).tile([bs, 1, 1])
          if self.dual_queries:
              target = paddle.concat(
                  [target]
                  + [
                      self.tgt_embed_dual[g_id]
                      .weight.unsqueeze(0)
                      .tile([bs, 1, 1])
                      for g_id in range(self.dual_groups)
                  ],
                  1,
              )
      else:
          if self.dual_queries:
              target = paddle.gather_nd(output_memory[0], topk_ind)
              target_groups = []
              for g_id in range(self.dual_groups):
                  target_gid = paddle.gather_nd(
                      output_memory[g_id + 1], topk_ind_groups[g_id]
                  )
                  target_groups.append(target_gid)
              target = paddle.concat(
                  [target] + target_groups, 1
              ).detach()
          else:
              target = paddle.gather_nd(
                  output_memory, topk_ind
              ).detach()
  
      if denoising_bbox is not None:
          if (
              isinstance(denoising_bbox, list)
              and isinstance(denoising_class, list)
              and self.dual_queries
          ):
              if denoising_bbox[0] is not None:
                  reference_points_list = paddle.split(
                      reference_points, self.dual_groups + 1, axis=1
                  )
                  reference_points = paddle.concat(
                      [
                          paddle.concat([ref, ref_], axis=1)
                          for ref, ref_ in zip(
                              denoising_bbox, reference_points_list
                          )
                      ],
                      axis=1,
                  )
  
                  target_list = paddle.split(
                      target, self.dual_groups + 1, axis=1
                  )
                  target = paddle.concat(
                      [
                          paddle.concat([tgt, tgt_], axis=1)
                          for tgt, tgt_ in zip(
                              denoising_class, target_list
                          )
                      ],
                      axis=1,
                  )
              else:
                  reference_points, target = reference_points, target
          else:
              reference_points = paddle.concat(
                  [denoising_bbox, reference_points], 1
              )
              target = paddle.concat([denoising_class, target], 1)
  
      return target, reference_points, 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 .position_encoding import PositionEmbedding
  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_valid_ratio, get_contrastive_denoising_training_group, get_sine_pos_embed, inverse_sigmoid
label_desc: Use image node_id 8 for calling the GroupDINOTransformer obj's underlying member method code with example usage: obj._get_decoder_input(memory, spatial_shapes, memory_mask, denoising_class, denoising_bbox) and returns: target,  reference_points,  enc_topk_bboxes,  enc_topk_logits