class_docstr: Implementation of `DAB-DETR:
  Dynamic Anchor Boxes are Better Queries for DETR.
  
  <https://arxiv.org/abs/2201.12329>`_.
  
  Code is modified from the `official github repo
  <https://github.com/IDEA-Research/DAB-DETR>`_.
  
  Args:
      with_random_refpoints (bool): Whether to randomly initialize query
          embeddings and not update them during training.
          Defaults to False.
      num_patterns (int): Inspired by Anchor-DETR. Defaults to 0.
class_docstr_tok: ["Implementation","of","`","DAB-DETR",":","Dynamic","Anchor","Boxes","are","Better","Queries","for","DETR",".","<","https",":","\/\/arxiv.org\/abs\/2201.12329",">","`","_",".","Code","is","modified","from","the","`","official","github","repo","<","https",":","\/\/github.com\/IDEA-Research\/DAB-DETR",">","`","_",".","Args",":","with_random_refpoints","(","bool",")",":","Whether","to","randomly","initialize","query","embeddings","and","not","update","them","during","training",".","Defaults","to","False",".","num_patterns","(","int",")",":","Inspired","by","Anchor-DETR",".","Defaults","to","0","."]
docstr: Forward with Transformer decoder.
  
  Args:
      query (Tensor): The queries of decoder inputs, has shape
          (bs, num_queries, dim).
      query_pos (Tensor): The positional queries of decoder inputs,
          has shape (bs, num_queries, dim).
      memory (Tensor): The output embeddings of the Transformer encoder,
          has shape (bs, num_feat_points, dim).
      memory_mask (Tensor): ByteTensor, the padding mask of the memory,
          has shape (bs, num_feat_points).
      memory_pos (Tensor): The positional embeddings of memory, has
          shape (bs, num_feat_points, dim).
  
  Returns:
      dict: The dictionary of decoder outputs, which includes the
      `hidden_states` and `references` of the decoder output.
docstr_tok: ["Forward","with","Transformer","decoder",".","Args",":","query","(","Tensor",")",":","The","queries","of","decoder","inputs",",","has","shape","(","bs",",","num_queries",",","dim",")",".","query_pos","(","Tensor",")",":","The","positional","queries","of","decoder","inputs",",","has","shape","(","bs",",","num_queries",",","dim",")",".","memory","(","Tensor",")",":","The","output","embeddings","of","the","Transformer","encoder",",","has","shape","(","bs",",","num_feat_points",",","dim",")",".","memory_mask","(","Tensor",")",":","ByteTensor",",","the","padding","mask","of","the","memory",",","has","shape","(","bs",",","num_feat_points",")",".","memory_pos","(","Tensor",")",":","The","positional","embeddings","of","memory",",","has","shape","(","bs",",","num_feat_points",",","dim",")",".","Returns",":","dict",":","The","dictionary","of","decoder","outputs",",","which","includes","the","`","hidden_states","`","and","`","references","`","of","the","decoder","output","."]
code: def forward_decoder(
      self,
      query: Tensor,
      query_pos: Tensor,
      memory: Tensor,
      memory_mask: Tensor,
      memory_pos: Tensor,
  ) -> Dict:
      """Forward with Transformer decoder.
  
      Args:
          query (Tensor): The queries of decoder inputs, has shape
              (bs, num_queries, dim).
          query_pos (Tensor): The positional queries of decoder inputs,
              has shape (bs, num_queries, dim).
          memory (Tensor): The output embeddings of the Transformer encoder,
              has shape (bs, num_feat_points, dim).
          memory_mask (Tensor): ByteTensor, the padding mask of the memory,
              has shape (bs, num_feat_points).
          memory_pos (Tensor): The positional embeddings of memory, has
              shape (bs, num_feat_points, dim).
  
      Returns:
          dict: The dictionary of decoder outputs, which includes the
          `hidden_states` and `references` of the decoder output.
      """
  
      hidden_states, references = self.decoder(
          query=query,
          key=memory,
          query_pos=query_pos,
          key_pos=memory_pos,
          key_padding_mask=memory_mask,
          reg_branches=self.bbox_head.fc_reg,  # iterative refinement for anchor boxes
      )
      head_inputs_dict = dict(
          hidden_states=hidden_states, references=references
      )
      return head_inputs_dict
  
file_path: mmdetection/mmdet/models/detectors/dab_detr.py
imports: from typing import Dict, Tuple
  from mmengine.model import uniform_init
  from torch import Tensor, nn
  from mmdet.registry import MODELS
  from ..layers import SinePositionalEncoding
  from ..layers.transformer import DABDetrTransformerDecoder, DABDetrTransformerEncoder, inverse_sigmoid
  from .detr import DETR
label_desc: Use image node_id 5 for calling the DABDETR obj's underlying member method code with example usage: obj.forward_decoder(query, query_pos, memory, memory_mask, memory_pos) and returns: head_inputs_dict