class_docstr: Head of DeformDETR: Deformable DETR: Deformable Transformers for
  End-to-End Object Detection.
  
  Code is modified from the `official github repo
  <https://github.com/fundamentalvision/Deformable-DETR>`_.
  
  More details can be found in the `paper
  <https://arxiv.org/abs/2010.04159>`_ .
  
  Args:
      share_pred_layer (bool): Whether to share parameters for all the
          prediction layers. Defaults to `False`.
      num_pred_layer (int): The number of the prediction layers.
          Defaults to 6.
      as_two_stage (bool, optional): Whether to generate the proposal
          from the outputs of encoder. Defaults to `False`.
docstr: Transform a batch of output features extracted from the head into
  bbox results.
  
  Args:
      all_layers_cls_scores (Tensor): Classification scores of all
          decoder layers, has shape (num_decoder_layers, bs, num_queries,
          cls_out_channels).
      all_layers_bbox_preds (Tensor): Regression outputs of all decoder
          layers. Each is a 4D-tensor with normalized coordinate format
          (cx, cy, w, h) and shape (num_decoder_layers, bs, num_queries,
          4) with the last dimension arranged as (cx, cy, w, h).
      batch_img_metas (list[dict]): Meta information of each image.
      rescale (bool, optional): If `True`, return boxes in original
          image space. Default `False`.
  
  Returns:
      list[obj:`InstanceData`]: Detection results of each image
      after the post process.
docstr_tok: ["Transform","a","batch","of","output","features","extracted","from","the","head","into","bbox","results",".","Args",":","all_layers_cls_scores","(","Tensor",")",":","Classification","scores","of","all","decoder","layers",",","has","shape","(","num_decoder_layers",",","bs",",","num_queries",",","cls_out_channels",")",".","all_layers_bbox_preds","(","Tensor",")",":","Regression","outputs","of","all","decoder","layers",".","Each","is","a","4D-tensor","with","normalized","coordinate","format","(","cx",",","cy",",","w",",","h",")","and","shape","(","num_decoder_layers",",","bs",",","num_queries",",","4",")","with","the","last","dimension","arranged","as","(","cx",",","cy",",","w",",","h",")",".","batch_img_metas","(","list","[","dict","]",")",":","Meta","information","of","each","image",".","rescale","(","bool",",","optional",")",":","If","`","True","`",",","return","boxes","in","original","image","space",".","Default","`","False","`",".","Returns",":","list","[","obj",":","`","InstanceData","`","]",":","Detection","results","of","each","image","after","the","post","process","."]
code: def predict_by_feat(
      self,
      all_layers_cls_scores: Tensor,
      all_layers_bbox_preds: Tensor,
      batch_img_metas: List[Dict],
      rescale: bool = False,
  ) -> InstanceList:
      """Transform a batch of output features extracted from the head into
      bbox results.
  
      Args:
          all_layers_cls_scores (Tensor): Classification scores of all
              decoder layers, has shape (num_decoder_layers, bs, num_queries,
              cls_out_channels).
          all_layers_bbox_preds (Tensor): Regression outputs of all decoder
              layers. Each is a 4D-tensor with normalized coordinate format
              (cx, cy, w, h) and shape (num_decoder_layers, bs, num_queries,
              4) with the last dimension arranged as (cx, cy, w, h).
          batch_img_metas (list[dict]): Meta information of each image.
          rescale (bool, optional): If `True`, return boxes in original
              image space. Default `False`.
  
      Returns:
          list[obj:`InstanceData`]: Detection results of each image
          after the post process.
      """
      cls_scores = all_layers_cls_scores[-1]
      bbox_preds = all_layers_bbox_preds[-1]
  
      result_list = []
      for img_id in range(len(batch_img_metas)):
          cls_score = cls_scores[img_id]
          bbox_pred = bbox_preds[img_id]
          img_meta = batch_img_metas[img_id]
          results = self._predict_by_feat_single(
              cls_score, bbox_pred, img_meta, rescale
          )
          result_list.append(results)
      return result_list
  
imports: import copy
  from typing import Dict, List, Tuple
  import torch
  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, OptInstanceList
  from ..layers import inverse_sigmoid
  from .detr_head import DETRHead
label_desc: Use image node_id 8 for calling the DeformableDETRHead obj's underlying member method code with example usage: obj.predict_by_feat(all_layers_cls_scores, all_layers_bbox_preds, batch_img_metas, rescale) and returns: result_list