class_docstr: Transformer Decoder Layer.
  
  Args:
      d_model (int): The number of expected features
          in the decoder inputs (default=512).
      d_inner (int): The dimension of the feedforward
          network model (default=256).
      n_head (int): The number of heads in the
          multiheadattention models (default=8).
      d_k (int): Total number of features in key.
      d_v (int): Total number of features in value.
      dropout (float): Dropout layer on attn_output_weights.
      qkv_bias (bool): Add bias in projection layer. Default: False.
      act_cfg (dict): Activation cfg for feedforward module.
      operation_order (tuple[str]): The execution order of operation
          in transformer. Such as ('self_attn', 'norm', 'enc_dec_attn',
          'norm', 'ffn', 'norm') or ('norm', 'self_attn', 'norm',
          'enc_dec_attn', 'norm', 'ffn').
          Default：None.
code: def __init__(
      self,
      d_model=512,
      d_inner=256,
      n_head=8,
      d_k=64,
      d_v=64,
      dropout=0.1,
      qkv_bias=False,
      act_cfg=dict(type="mmengine.GELU"),
      operation_order=None,
  ):
      super().__init__()
  
      self.norm1 = nn.LayerNorm(d_model)
      self.norm2 = nn.LayerNorm(d_model)
      self.norm3 = nn.LayerNorm(d_model)
  
      self.self_attn = MultiHeadAttention(
          n_head, d_model, d_k, d_v, dropout=dropout, qkv_bias=qkv_bias
      )
  
      self.enc_attn = MultiHeadAttention(
          n_head, d_model, d_k, d_v, dropout=dropout, qkv_bias=qkv_bias
      )
  
      self.mlp = PositionwiseFeedForward(
          d_model, d_inner, dropout=dropout, act_cfg=act_cfg
      )
  
      self.operation_order = operation_order
      if self.operation_order is None:
          self.operation_order = (
              "norm",
              "self_attn",
              "norm",
              "enc_dec_attn",
              "norm",
              "ffn",
          )
      assert self.operation_order in [
          ("norm", "self_attn", "norm", "enc_dec_attn", "norm", "ffn"),
          ("self_attn", "norm", "enc_dec_attn", "norm", "ffn", "norm"),
      ]
  
file_path: mmocr/mmocr/models/common/layers/transformer_layers.py
imports: import torch.nn
  from mmengine.model import BaseModule
  from mmocr.models.common.modules import MultiHeadAttention, PositionwiseFeedForward
label_desc: Use image node_id 1 to create a new TFDecoderLayer object from inherited base classes: nn with example: obj = TFDecoderLayer(d_model, d_inner, n_head, d_k, d_v, dropout, qkv_bias, act_cfg, operation_order)