class_docstr: TransformerEncoder of DETR.
  
  Args:
      post_norm_cfg (dict): Config of last normalization layer. Default：
          `LN`. Only used when `self.pre_norm` is `True`
class_docstr_tok: ["TransformerEncoder","of","DETR",".","Args",":","post_norm_cfg","(","dict",")",":","Config","of","last","normalization","layer",".","Default\uff1a","`","LN","`",".","Only","used","when","`","self.pre_norm","`","is","`","True","`"]
code: def __init__(
      self, *args, post_norm_cfg=dict(type="LN"), with_cp=-1, **kwargs
  ):
      super(DetrTransformerEncoder, self).__init__(*args, **kwargs)
      if post_norm_cfg is not None:
          self.post_norm = (
              build_norm_layer(post_norm_cfg, self.embed_dims)[1]
              if self.pre_norm
              else None
          )
      else:
          assert not self.pre_norm, (
              f"Use prenorm in "
              f"{self.__class__.__name__},"
              f"Please specify post_norm_cfg"
          )
          self.post_norm = None
      self.with_cp = with_cp
      if self.with_cp > 0:
          if checkpoint_wrapper is None:
              warnings.warn(
                  "If you want to reduce GPU memory usage, \
                                please install fairscale by executing the \
                                following command: pip install fairscale."
              )
              return
          for i in range(self.with_cp):
              self.layers[i] = checkpoint_wrapper(self.layers[i])
  
imports: import math
  import warnings
  import torch
  import torch.nn
  from mmcv.cnn import build_norm_layer
  from mmcv.cnn.bricks.transformer import BaseTransformerLayer, TransformerLayerSequence, build_transformer_layer_sequence
  from mmcv.ops import MultiScaleDeformableAttention
  from mmengine.model import BaseModule
  from mmengine.model.weight_init import xavier_init
  from torch.nn.init import normal_
  from mmdet.models.layers.transformer import inverse_sigmoid
  from mmdet.registry import MODELS
label_desc: Use image node_id 1 to create a new DetrTransformerEncoder object from inherited base classes: TransformerLayerSequence with example: obj = DetrTransformerEncoder()