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: Initialize classification branch and regression branch of head.
docstr_tok: ["Initialize","classification","branch","and","regression","branch","of","head","."]
code: def _init_layers(self) -> None:
      """Initialize classification branch and regression branch of head."""
      fc_cls = Linear(self.embed_dims, self.cls_out_channels)
      reg_branch = []
      for _ in range(self.num_reg_fcs):
          reg_branch.append(Linear(self.embed_dims, self.embed_dims))
          reg_branch.append(nn.ReLU())
      reg_branch.append(Linear(self.embed_dims, 4))
      reg_branch = nn.Sequential(*reg_branch)
  
      if self.share_pred_layer:
          self.cls_branches = nn.ModuleList(
              [fc_cls for _ in range(self.num_pred_layer)]
          )
          self.reg_branches = nn.ModuleList(
              [reg_branch for _ in range(self.num_pred_layer)]
          )
      else:
          self.cls_branches = nn.ModuleList(
              [
                  copy.deepcopy(fc_cls)
                  for _ in range(self.num_pred_layer)
              ]
          )
          self.reg_branches = nn.ModuleList(
              [
                  copy.deepcopy(reg_branch)
                  for _ in range(self.num_pred_layer)
              ]
          )
  
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 2 for calling the DeformableDETRHead obj's underlying member method code with example usage: obj._init_layers() without return types