class_docstr: AWD-LSTM inspired by https://arxiv.org/abs/1708.02182
class_docstr_tok: ["AWD-LSTM","inspired","by","https",":","\/\/arxiv.org\/abs\/1708.02182"]
code: def __init__(
      self,
      vocab_sz: int,  # Size of the vocabulary
      emb_sz: int,  # Size of embedding vector
      n_hid: int,  # Number of features in hidden state
      n_layers: int,  # Number of LSTM layers
      pad_token: int = 1,  # Padding token id
      hidden_p: float = 0.2,  # Dropout probability for hidden state between layers
      input_p: float = 0.6,  # Dropout probability for LSTM stack input
      embed_p: float = 0.1,  # Embedding layer dropout probabillity
      weight_p: float = 0.5,  # Hidden-to-hidden wight dropout probability for LSTM layers
      bidir: bool = False,  # If set to `True` uses bidirectional LSTM layers
  ):
      store_attr("emb_sz,n_hid,n_layers,pad_token")
      self.bs = 1
      self.n_dir = 2 if bidir else 1
      self.encoder = nn.Embedding(
          vocab_sz, emb_sz, padding_idx=pad_token
      )
      self.encoder_dp = EmbeddingDropout(self.encoder, embed_p)
      self.rnns = nn.ModuleList(
          [
              self._one_rnn(
                  emb_sz if l == 0 else n_hid,
                  (n_hid if l != n_layers - 1 else emb_sz)
                  // self.n_dir,
                  bidir,
                  weight_p,
                  l,
              )
              for l in range(n_layers)
          ]
      )
      self.encoder.weight.data.uniform_(-self.initrange, self.initrange)
      self.input_dp = RNNDropout(input_p)
      self.hidden_dps = nn.ModuleList(
          [RNNDropout(hidden_p) for l in range(n_layers)]
      )
      self.reset()
  
imports: from __future__ import annotations
  from ...data.all import *
  from ..core import *
label_desc: Use image node_id 1 to create a new AWD_LSTM object from inherited base classes: Module with example: obj = AWD_LSTM(vocab_sz, emb_sz, n_hid, n_layers, pad_token, hidden_p, input_p, embed_p, weight_p, bidir)