docstr: Initialize encoder layers.
docstr_tok: ["Initialize","encoder","layers","."]
code: def _init_layers(self) -> None:
      """Initialize encoder layers."""
      self.layers = ModuleList(
          [
              DeformableDetrTransformerEncoderLayer(**self.layer_cfg)
              for _ in range(self.num_layers)
          ]
      )
      self.text_layers = ModuleList(
          [
              DetrTransformerEncoderLayer(**self.text_layer_cfg)
              for _ in range(self.num_layers)
          ]
      )
      self.fusion_layers = ModuleList(
          [
              SingleScaleBiAttentionBlock(**self.fusion_layer_cfg)
              for _ in range(self.num_layers)
          ]
      )
      self.embed_dims = self.layers[0].embed_dims
      if self.num_cp > 0:
          if checkpoint_wrapper is None:
              raise NotImplementedError(
                  "If you want to reduce GPU memory usage, \
                      please install fairscale by executing the \
                      following command: pip install fairscale."
              )
          for i in range(self.num_cp):
              self.layers[i] = checkpoint_wrapper(self.layers[i])
              self.fusion_layers[i] = checkpoint_wrapper(
                  self.fusion_layers[i]
              )
  
imports: import torch
  import torch.nn
  from mmcv.cnn import build_norm_layer
  from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
  from mmcv.ops import MultiScaleDeformableAttention
  from mmengine.model import ModuleList
  from torch import Tensor
  from mmdet.models.utils.vlfuse_helper import SingleScaleBiAttentionBlock
  from mmdet.utils import ConfigType, OptConfigType
  from .deformable_detr_layers import DeformableDetrTransformerDecoderLayer, DeformableDetrTransformerEncoder, DeformableDetrTransformerEncoderLayer
  from .detr_layers import DetrTransformerEncoderLayer
  from .dino_layers import DinoTransformerDecoder
  from .utils import MLP, get_text_sine_pos_embed
label_desc: Use image node_id 2 for calling the GroundingDinoTransformerEncoder obj's underlying member method code with example usage: obj._init_layers() without return types