class_docstr: Head of Conditional DETR. Conditional DETR: Conditional DETR for Fast
  Training Convergence. More details can be found in the `paper.
  
  <https://arxiv.org/abs/2108.06152>`_ .
class_docstr_tok: ["Head","of","Conditional","DETR",".","Conditional","DETR",":","Conditional","DETR","for","Fast","Training","Convergence",".","More","details","can","be","found","in","the","`","paper",".","<","https",":","\/\/arxiv.org\/abs\/2108.06152",">","`","_","."]
docstr: Perform forward propagation and loss calculation of the detection
  head on the features of the upstream network.
  
  Args:
      hidden_states (Tensor): Features from the transformer decoder, has
          shape (num_decoder_layers, bs, num_queries, dim).
      references (Tensor): References from the transformer decoder, has
         shape (num_decoder_layers, bs, num_queries, 2).
      batch_data_samples (List[:obj:`DetDataSample`]): The Data
          Samples. It usually includes information such as
          `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
  
  Returns:
      dict: A dictionary of loss components.
docstr_tok: ["Perform","forward","propagation","and","loss","calculation","of","the","detection","head","on","the","features","of","the","upstream","network",".","Args",":","hidden_states","(","Tensor",")",":","Features","from","the","transformer","decoder",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","dim",")",".","references","(","Tensor",")",":","References","from","the","transformer","decoder",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","2",")",".","batch_data_samples","(","List","[",":","obj",":","`","DetDataSample","`","]",")",":","The","Data","Samples",".","It","usually","includes","information","such","as","`","gt_instance","`",",","`","gt_panoptic_seg","`","and","`","gt_sem_seg","`",".","Returns",":","dict",":","A","dictionary","of","loss","components","."]
code: def loss(
      self,
      hidden_states: Tensor,
      references: Tensor,
      batch_data_samples: SampleList,
  ) -> dict:
      """Perform forward propagation and loss calculation of the detection
      head on the features of the upstream network.
  
      Args:
          hidden_states (Tensor): Features from the transformer decoder, has
              shape (num_decoder_layers, bs, num_queries, dim).
          references (Tensor): References from the transformer decoder, has
             shape (num_decoder_layers, bs, num_queries, 2).
          batch_data_samples (List[:obj:`DetDataSample`]): The Data
              Samples. It usually includes information such as
              `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
  
      Returns:
          dict: A dictionary of loss components.
      """
      batch_gt_instances = []
      batch_img_metas = []
      for data_sample in batch_data_samples:
          batch_img_metas.append(data_sample.metainfo)
          batch_gt_instances.append(data_sample.gt_instances)
  
      outs = self(hidden_states, references)
      loss_inputs = outs + (batch_gt_instances, batch_img_metas)
      losses = self.loss_by_feat(*loss_inputs)
      return losses
  
file_path: mmdetection/mmdet/models/dense_heads/conditional_detr_head.py
imports: from typing import Tuple
  import torch
  import torch.nn
  from mmengine.model import bias_init_with_prob
  from torch import Tensor
  from mmdet.models.layers.transformer import inverse_sigmoid
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import InstanceList
  from .detr_head import DETRHead
label_desc: Use image node_id 3 for calling the ConditionalDETRHead obj's underlying member method code with example usage: obj.loss(hidden_states, references, batch_data_samples) and returns: losses