class_docstr: Implements encoder layer in DETR transformer.
  
  Args:
      self_attn_cfg (:obj:`ConfigDict` or dict, optional): Config for self
          attention.
      ffn_cfg (:obj:`ConfigDict` or dict, optional): Config for FFN.
      norm_cfg (:obj:`ConfigDict` or dict, optional): Config for
          normalization layers. All the layers will share the same
          config. Defaults to `LN`.
      init_cfg (:obj:`ConfigDict` or dict, optional): Config to control
          the initialization. Defaults to None.
class_docstr_tok: ["Implements","encoder","layer","in","DETR","transformer",".","Args",":","self_attn_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","for","self","attention",".","ffn_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","for","FFN",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","for","normalization","layers",".","All","the","layers","will","share","the","same","config",".","Defaults","to","`","LN","`",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","to","control","the","initialization",".","Defaults","to","None","."]
docstr: Forward function of an encoder layer.
  
  Args:
      query (Tensor): The input query, has shape (bs, num_queries, dim).
      query_pos (Tensor): The positional encoding for query, with
          the same shape as `query`.
      key_padding_mask (Tensor): The `key_padding_mask` of `self_attn`
          input. ByteTensor. has shape (bs, num_queries).
  Returns:
      Tensor: forwarded results, has shape (bs, num_queries, dim).
docstr_tok: ["Forward","function","of","an","encoder","layer",".","Args",":","query","(","Tensor",")",":","The","input","query",",","has","shape","(","bs",",","num_queries",",","dim",")",".","query_pos","(","Tensor",")",":","The","positional","encoding","for","query",",","with","the","same","shape","as","`","query","`",".","key_padding_mask","(","Tensor",")",":","The","`","key_padding_mask","`","of","`","self_attn","`","input",".","ByteTensor",".","has","shape","(","bs",",","num_queries",")",".","Returns",":","Tensor",":","forwarded","results",",","has","shape","(","bs",",","num_queries",",","dim",")","."]
code: def forward(
      self,
      query: Tensor,
      query_pos: Tensor,
      key_padding_mask: Tensor,
      **kwargs,
  ) -> Tensor:
      """Forward function of an encoder layer.
  
      Args:
          query (Tensor): The input query, has shape (bs, num_queries, dim).
          query_pos (Tensor): The positional encoding for query, with
              the same shape as `query`.
          key_padding_mask (Tensor): The `key_padding_mask` of `self_attn`
              input. ByteTensor. has shape (bs, num_queries).
      Returns:
          Tensor: forwarded results, has shape (bs, num_queries, dim).
      """
      query = self.self_attn(
          query=query,
          key=query,
          value=query,
          query_pos=query_pos,
          key_pos=query_pos,
          key_padding_mask=key_padding_mask,
          **kwargs,
      )
      query = self.norms[0](query)
      query = self.ffn(query)
      query = self.norms[1](query)
  
      return query
  
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 3 for calling the DetrTransformerEncoderLayer obj's underlying member method code with example usage: obj.forward(query, query_pos, key_padding_mask) and returns: query