class_docstr: Encoder of DETR.
  
  Args:
      num_layers (int): Number of encoder layers.
      layer_cfg (:obj:`ConfigDict` or dict): the config of each encoder
          layer. All the layers will share the same config.
      num_cp (int): Number of checkpointing blocks in encoder layer.
          Default to -1.
      init_cfg (:obj:`ConfigDict` or dict, optional): the config to control
          the initialization. Defaults to None.
class_docstr_tok: ["Encoder","of","DETR",".","Args",":","num_layers","(","int",")",":","Number","of","encoder","layers",".","layer_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","the","config","of","each","encoder","layer",".","All","the","layers","will","share","the","same","config",".","num_cp","(","int",")",":","Number","of","checkpointing","blocks","in","encoder","layer",".","Default","to","-1.","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","the","config","to","control","the","initialization",".","Defaults","to","None","."]
code: def __init__(
      self,
      num_layers: int,
      layer_cfg: ConfigType,
      num_cp: int = -1,
      init_cfg: OptConfigType = None,
  ) -> None:
      super().__init__(init_cfg=init_cfg)
      self.num_layers = num_layers
      self.layer_cfg = layer_cfg
      self.num_cp = num_cp
      assert self.num_cp <= self.num_layers
      self._init_layers()
  
imports: from typing import Union
  import torch
  from mmcv.cnn import build_norm_layer
  from mmcv.cnn.bricks.transformer import FFN, MultiheadAttention
  from mmengine import ConfigDict
  from mmengine.model import BaseModule, ModuleList
  from torch import Tensor
  from mmdet.utils import ConfigType, OptConfigType
label_desc: Use image node_id 1 to create a new DetrTransformerEncoder object from inherited base classes: BaseModule with example: obj = DetrTransformerEncoder(num_layers, layer_cfg, num_cp, init_cfg)