class_docstr: Head of DAB-DETR. DAB-DETR: Dynamic Anchor Boxes are Better Queries for
  DETR.
  
  More details can be found in the `paper
  <https://arxiv.org/abs/2201.12329>`_ .
docstr: "Forward function.
  
  Args:
      hidden_states (Tensor): Features from transformer decoder. If
          `return_intermediate_dec` 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.
      references (Tensor): References from transformer decoder. If
          `return_intermediate_dec` is True output has shape
          (num_decoder_layers, bs, num_queries, 2/4), else has shape (1,
          bs, num_queries, 2/4)
          which only contains the last layer reference.
  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","`","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",".","references","(","Tensor",")",":","References","from","transformer","decoder",".","If","`","return_intermediate_dec","`","is","True","output","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","2\/4",")",",","else","has","shape","(","1",",","bs",",","num_queries",",","2\/4",")","which","only","contains","the","last","layer","reference",".","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, references: Tensor
  ) -> Tuple[Tensor, Tensor]:
      """ "Forward function.
  
      Args:
          hidden_states (Tensor): Features from transformer decoder. If
              `return_intermediate_dec` 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.
          references (Tensor): References from transformer decoder. If
              `return_intermediate_dec` is True output has shape
              (num_decoder_layers, bs, num_queries, 2/4), else has shape (1,
              bs, num_queries, 2/4)
              which only contains the last layer reference.
      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)
      references_before_sigmoid = inverse_sigmoid(references, eps=1e-3)
      tmp_reg_preds = self.fc_reg(hidden_states)
      tmp_reg_preds[
          ..., : references_before_sigmoid.size(-1)
      ] += references_before_sigmoid
      layers_bbox_preds = tmp_reg_preds.sigmoid()
      return layers_cls_scores, layers_bbox_preds
  
file_path: mmdetection/mmdet/models/dense_heads/dab_detr_head.py
imports: from typing import Tuple
  import torch.nn
  from mmcv.cnn import Linear
  from mmengine.model import bias_init_with_prob, constant_init
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import InstanceList
  from ..layers import MLP, inverse_sigmoid
  from .conditional_detr_head import ConditionalDETRHead
label_desc: Use image node_id 3 for calling the DABDETRHead obj's underlying member method code with example usage: obj.forward(hidden_states, references) and returns: layers_cls_scores,  layers_bbox_preds