class_docstr: Head of DETR. DETR:End-to-End Object Detection with Transformers.
  
  More details can be found in the `paper
  <https://arxiv.org/pdf/2005.12872>`_ .
  
  Args:
      num_classes (int): Number of categories excluding the background.
      embed_dims (int): The dims of Transformer embedding.
      num_reg_fcs (int): Number of fully-connected layers used in `FFN`,
          which is then used for the regression head. Defaults to 2.
      sync_cls_avg_factor (bool): Whether to sync the `avg_factor` of
          all ranks. Default to `False`.
      loss_cls (:obj:`ConfigDict` or dict): Config of the classification
          loss. Defaults to `CrossEntropyLoss`.
      loss_bbox (:obj:`ConfigDict` or dict): Config of the regression bbox
          loss. Defaults to `L1Loss`.
      loss_iou (:obj:`ConfigDict` or dict): Config of the regression iou
          loss. Defaults to `GIoULoss`.
      train_cfg (:obj:`ConfigDict` or dict): Training config of transformer
          head.
      test_cfg (:obj:`ConfigDict` or dict): Testing config of transformer
          head.
      init_cfg (:obj:`ConfigDict` or dict, optional): the config to control
          the initialization. Defaults to None.
docstr: "Forward function.
  
  Args:
      hidden_states (Tensor): Features from transformer decoder. If
          `return_intermediate_dec` in detr.py is True output has shape
          (num_decoder_layers, bs, num_queries, dim), else has shape
          (1, bs, num_queries, dim) which only contains the last layer
          outputs.
  Returns:
      tuple[Tensor]: results of head containing the following tensor.
  
      - layers_cls_scores (Tensor): Outputs from the classification head,
        shape (num_decoder_layers, bs, num_queries, cls_out_channels).
        Note cls_out_channels should include background.
      - layers_bbox_preds (Tensor): Sigmoid outputs from the regression
        head with normalized coordinate format (cx, cy, w, h), has shape
        (num_decoder_layers, bs, num_queries, 4).
docstr_tok: ["``","Forward","function",".","Args",":","hidden_states","(","Tensor",")",":","Features","from","transformer","decoder",".","If","`","return_intermediate_dec","`","in","detr.py","is","True","output","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","dim",")",",","else","has","shape","(","1",",","bs",",","num_queries",",","dim",")","which","only","contains","the","last","layer","outputs",".","Returns",":","tuple","[","Tensor","]",":","results","of","head","containing","the","following","tensor",".","-","layers_cls_scores","(","Tensor",")",":","Outputs","from","the","classification","head",",","shape","(","num_decoder_layers",",","bs",",","num_queries",",","cls_out_channels",")",".","Note","cls_out_channels","should","include","background",".","-","layers_bbox_preds","(","Tensor",")",":","Sigmoid","outputs","from","the","regression","head","with","normalized","coordinate","format","(","cx",",","cy",",","w",",","h",")",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","4",")","."]
code: def forward(self, hidden_states: Tensor) -> Tuple[Tensor]:
      """ "Forward function.
  
      Args:
          hidden_states (Tensor): Features from transformer decoder. If
              `return_intermediate_dec` in detr.py is True output has shape
              (num_decoder_layers, bs, num_queries, dim), else has shape
              (1, bs, num_queries, dim) which only contains the last layer
              outputs.
      Returns:
          tuple[Tensor]: results of head containing the following tensor.
  
          - layers_cls_scores (Tensor): Outputs from the classification head,
            shape (num_decoder_layers, bs, num_queries, cls_out_channels).
            Note cls_out_channels should include background.
          - layers_bbox_preds (Tensor): Sigmoid outputs from the regression
            head with normalized coordinate format (cx, cy, w, h), has shape
            (num_decoder_layers, bs, num_queries, 4).
      """
      layers_cls_scores = self.fc_cls(hidden_states)
      layers_bbox_preds = self.fc_reg(
          self.activate(self.reg_ffn(hidden_states))
      ).sigmoid()
      return layers_cls_scores, layers_bbox_preds
  
imports: from typing import Dict, List, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import Linear
  from mmcv.cnn.bricks.transformer import FFN
  from mmengine.model import BaseModule
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox_cxcywh_to_xyxy, bbox_overlaps, bbox_xyxy_to_cxcywh
  from mmdet.utils import ConfigType, InstanceList, OptInstanceList, OptMultiConfig, reduce_mean
  from ..losses import QualityFocalLoss
  from ..utils import multi_apply
label_desc: Use image node_id 3 for calling the DETRHead obj's underlying member method code with example usage: obj.forward(hidden_states) and returns: layers_cls_scores,  layers_bbox_preds