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().__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, nn.GELU()
      )
  
      self.attention_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.cross_attention_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.query_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.content_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.feed_forward_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.output_norm = nn.LayerNorm(d_model, eps=1e-5)
      self.attention_dropout = nn.Dropout(dropout)
      self.cross_attention_dropout = nn.Dropout(dropout)
      self.feed_forward_dropout = nn.Dropout(dropout)
  
imports: import math
  from copy import deepcopy
  from itertools import permutations
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from torch import nn
  from torch.nn import functional
  from torchvision.models._utils import IntermediateLayerGetter
  from doctr.datasets import VOCABS
  from doctr.models.modules.transformer import MultiHeadAttention, PositionwiseFeedForward
  from ...classification import vit_s
  from ...utils.pytorch 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: nn with example: obj = PARSeqDecoder(d_model, num_heads, ffd, ffd_ratio, dropout)