class_docstr: Implements decoder module of the PARSeq model
  
  Args:
  ----
      d_model: dimension of the model
      num_heads: number of attention heads
      ffd: dimension of the feed forward layer
      ffd_ratio: depth multiplier for the feed forward layer
      dropout: dropout rate
class_docstr_tok: ["Implements","decoder","module","of","the","PARSeq","model","Args",":","--","--","d_model",":","dimension","of","the","model","num_heads",":","number","of","attention","heads","ffd",":","dimension","of","the","feed","forward","layer","ffd_ratio",":","depth","multiplier","for","the","feed","forward","layer","dropout",":","dropout","rate"]
code: def __init__(
      self,
      d_model: int,
      num_heads: int = 12,
      ffd: int = 2048,
      ffd_ratio: int = 4,
      dropout: float = 0.1,
  ):
      super(PARSeqDecoder, self).__init__()
      self.attention = MultiHeadAttention(
          num_heads, d_model, dropout=dropout
      )
      self.cross_attention = MultiHeadAttention(
          num_heads, d_model, dropout=dropout
      )
      self.position_feed_forward = PositionwiseFeedForward(
          d_model,
          ffd * ffd_ratio,
          dropout,
          layers.Activation(tf.nn.gelu),
      )
  
      self.attention_norm = layers.LayerNormalization(epsilon=1e-5)
      self.cross_attention_norm = layers.LayerNormalization(
          epsilon=1e-5
      )
      self.query_norm = layers.LayerNormalization(epsilon=1e-5)
      self.content_norm = layers.LayerNormalization(epsilon=1e-5)
      self.feed_forward_norm = layers.LayerNormalization(epsilon=1e-5)
      self.output_norm = layers.LayerNormalization(epsilon=1e-5)
      self.attention_dropout = layers.Dropout(dropout)
      self.cross_attention_dropout = layers.Dropout(dropout)
      self.feed_forward_dropout = layers.Dropout(dropout)
  
imports: import math
  from copy import deepcopy
  from itertools import permutations
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow.keras import Model, layers
  from doctr.datasets import VOCABS
  from doctr.models.modules.transformer import MultiHeadAttention, PositionwiseFeedForward
  from ...classification import vit_s
  from ...utils.tensorflow import _bf16_to_float32, load_pretrained_params
  from .base import _PARSeq, _PARSeqPostProcessor
label_desc: Use image node_id 1 to create a new PARSeqDecoder object from inherited base classes: layers with example: obj = PARSeqDecoder(d_model, num_heads, ffd, ffd_ratio, dropout)