class_docstr: Decoder of DAB-DETR.
  
  Args:
      query_dim (int): The last dimension of query pos,
          4 for anchor format, 2 for point format.
          Defaults to 4.
      query_scale_type (str): Type of transformation applied
          to content query. Defaults to `cond_elewise`.
      with_modulated_hw_attn (bool): Whether to inject h&w info
          during cross conditional attention. Defaults to True.
docstr: Initialize decoder layers and other layers.
docstr_tok: ["Initialize","decoder","layers","and","other","layers","."]
code: def _init_layers(self):
      """Initialize decoder layers and other layers."""
      assert self.query_dim in [
          2,
          4,
      ], f'{"dab-detr only supports anchor prior or reference point prior"}'
      assert self.query_scale_type in [
          "cond_elewise",
          "cond_scalar",
          "fix_elewise",
      ]
  
      self.layers = ModuleList(
          [
              DABDetrTransformerDecoderLayer(**self.layer_cfg)
              for _ in range(self.num_layers)
          ]
      )
  
      embed_dims = self.layers[0].embed_dims
      self.embed_dims = embed_dims
  
      self.post_norm = build_norm_layer(self.post_norm_cfg, embed_dims)[
          1
      ]
      if self.query_scale_type == "cond_elewise":
          self.query_scale = MLP(embed_dims, embed_dims, embed_dims, 2)
      elif self.query_scale_type == "cond_scalar":
          self.query_scale = MLP(embed_dims, embed_dims, 1, 2)
      elif self.query_scale_type == "fix_elewise":
          self.query_scale = nn.Embedding(self.num_layers, embed_dims)
      else:
          raise NotImplementedError(
              "Unknown query_scale_type: {}".format(
                  self.query_scale_type
              )
          )
  
      self.ref_point_head = MLP(
          self.query_dim // 2 * embed_dims, embed_dims, embed_dims, 2
      )
  
      if self.with_modulated_hw_attn and self.query_dim == 4:
          self.ref_anchor_head = MLP(embed_dims, embed_dims, 2, 2)
  
      self.keep_query_pos = self.layers[0].keep_query_pos
      if not self.keep_query_pos:
          for layer_id in range(self.num_layers - 1):
              self.layers[layer_id + 1].cross_attn.qpos_proj = None
  
imports: from typing import List
  import torch
  import torch.nn
  from mmcv.cnn import build_norm_layer
  from mmcv.cnn.bricks.transformer import FFN
  from mmengine.model import ModuleList
  from torch import Tensor
  from .detr_layers import DetrTransformerDecoder, DetrTransformerDecoderLayer, DetrTransformerEncoder, DetrTransformerEncoderLayer
  from .utils import MLP, ConditionalAttention, coordinate_to_encoding, inverse_sigmoid
label_desc: Use image node_id 2 for calling the DABDetrTransformerDecoder obj's underlying member method code with example usage: obj._init_layers() without return types