class_docstr: LSTM encoder.
class_docstr_tok: ["LSTM","encoder","."]
code: def __init__(
      self,
      dictionary,
      embed_dim=512,
      hidden_size=512,
      num_layers=1,
      dropout_in=0.1,
      dropout_out=0.1,
      bidirectional=False,
      left_pad=True,
      pretrained_embed=None,
      padding_value=0.0,
      fixed_embeddings=False,
  ):
      super().__init__(dictionary)
      self.num_layers = num_layers
      self.dropout_in = dropout_in
      self.dropout_out = dropout_out
      self.bidirectional = bidirectional
      self.hidden_size = hidden_size
  
      num_embeddings = len(dictionary)
      self.padding_idx = dictionary.pad()
      if pretrained_embed is None:
          self.embed_tokens = Embedding(
              num_embeddings, embed_dim, self.padding_idx
          )
      else:
          self.embed_tokens = pretrained_embed
      if fixed_embeddings:
          self.embed_tokens.weight.requires_grad = False
  
      self.lstm = LSTM(
          input_size=embed_dim,
          hidden_size=hidden_size,
          num_layers=num_layers,
          dropout=self.dropout_out if num_layers > 1 else 0.0,
          bidirectional=bidirectional,
      )
      self.left_pad = left_pad
      self.padding_value = padding_value
  
      self.output_units = hidden_size
      if bidirectional:
          self.output_units *= 2
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoder, FairseqIncrementalDecoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
label_desc: Use image node_id 1 to create a new LSTMEncoder object from inherited base classes: FairseqEncoder with example: obj = LSTMEncoder(dictionary, embed_dim, hidden_size, num_layers, dropout_in, dropout_out, bidirectional, left_pad, pretrained_embed, padding_value, fixed_embeddings)