class_docstr: Implements one decoder layer in DETR transformer.
  
  Args:
      embed_dims (int): The feature dimension. Same as
          `TransformerEncoderLayer`.
      num_heads (int): Parallel attention heads.
      feedforward_channels (int): Same as `TransformerEncoderLayer`.
      dropout (float): Same as `TransformerEncoderLayer`. Default 0.0.
      order (tuple[str]): The order for decoder layer. Valid examples are
          ('selfattn', 'norm', 'multiheadattn', 'norm', 'ffn', 'norm') and
          ('norm', 'selfattn', 'norm', 'multiheadattn', 'norm', 'ffn').
          Default the former.
      act_cfg (dict): Same as `TransformerEncoderLayer`. Defalut ReLU.
      norm_cfg (dict): Config dict for normalization layer. Default
          layer normalization.
      num_fcs (int): The number of fully-connected layers in FFNs.
class_docstr_tok: ["Implements","one","decoder","layer","in","DETR","transformer",".","Args",":","embed_dims","(","int",")",":","The","feature","dimension",".","Same","as","`","TransformerEncoderLayer","`",".","num_heads","(","int",")",":","Parallel","attention","heads",".","feedforward_channels","(","int",")",":","Same","as","`","TransformerEncoderLayer","`",".","dropout","(","float",")",":","Same","as","`","TransformerEncoderLayer","`",".","Default","0.0.","order","(","tuple","[","str","]",")",":","The","order","for","decoder","layer",".","Valid","examples","are","(","'selfattn","'",",","'norm","'",",","'multiheadattn","'",",","'norm","'",",","'ffn","'",",","'norm","'",")","and","(","'norm","'",",","'selfattn","'",",","'norm","'",",","'multiheadattn","'",",","'norm","'",",","'ffn","'",")",".","Default","the","former",".","act_cfg","(","dict",")",":","Same","as","`","TransformerEncoderLayer","`",".","Defalut","ReLU",".","norm_cfg","(","dict",")",":","Config","dict","for","normalization","layer",".","Default","layer","normalization",".","num_fcs","(","int",")",":","The","number","of","fully-connected","layers","in","FFNs","."]
code: def __init__(
      self,
      embed_dims,
      num_heads,
      feedforward_channels,
      dropout=0.0,
      order=(
          "selfattn",
          "norm",
          "multiheadattn",
          "norm",
          "ffn",
          "norm",
      ),
      act_cfg=dict(type="ReLU", inplace=True),
      norm_cfg=dict(type="LN"),
      num_fcs=2,
  ):
      super(TransformerDecoderLayer, self).__init__()
      assert isinstance(order, tuple) and len(order) == 6
      assert set(order) == set(
          ["selfattn", "norm", "multiheadattn", "ffn"]
      )
      self.embed_dims = embed_dims
      self.num_heads = num_heads
      self.feedforward_channels = feedforward_channels
      self.dropout = dropout
      self.order = order
      self.act_cfg = act_cfg
      self.norm_cfg = norm_cfg
      self.num_fcs = num_fcs
      self.pre_norm = order[0] == "norm"
      self.self_attn = MultiheadAttention(
          embed_dims, num_heads, dropout
      )
      self.multihead_attn = MultiheadAttention(
          embed_dims, num_heads, dropout
      )
      self.ffn = FFN(
          embed_dims, feedforward_channels, num_fcs, act_cfg, dropout
      )
      self.norms = nn.ModuleList()
      # 3 norm layers in official DETR's TransformerDecoderLayer
      for _ in range(3):
          self.norms.append(build_norm_layer(norm_cfg, embed_dims)[1])
  
imports: import torch
  import torch.nn
  from mmcv.cnn import Linear, build_activation_layer, build_norm_layer, xavier_init
  from .builder import TRANSFORMER
label_desc: Use image node_id 1 to create a new TransformerDecoderLayer object from inherited base classes: nn with example: obj = TransformerDecoderLayer(embed_dims, num_heads, feedforward_channels, dropout, order, act_cfg, norm_cfg, num_fcs)