class_docstr: Basic LSTM model for language modeling.
  
  Arguments
  ---------
  embedding_dim : int
      The dimension of the embeddings.The input indexes are transformed into
      a latent space with this dimensionality.
  rnn_size : int
      Number of neurons to use in rnn (for each direction -> and <-).
  layers : int
      Number of RNN layers to use.
  output_dim : int
      Dimensionality of the output.
  return_hidden : bool
      If True, returns the hidden state of the RNN as well.
class_docstr_tok: ["Basic","LSTM","model","for","language","modeling",".","Arguments","--","--","--","--","-","embedding_dim",":","int","The","dimension","of","the","embeddings.The","input","indexes","are","transformed","into","a","latent","space","with","this","dimensionality",".","rnn_size",":","int","Number","of","neurons","to","use","in","rnn","(","for","each","direction","-",">","and","<","-",")",".","layers",":","int","Number","of","RNN","layers","to","use",".","output_dim",":","int","Dimensionality","of","the","output",".","return_hidden",":","bool","If","True",",","returns","the","hidden","state","of","the","RNN","as","well","."]
docstr: List of computations from input to output predictions
docstr_tok: ["List","of","computations","from","input","to","output","predictions"]
code: def forward(self, x, hx=None):
      """List of computations from input to output predictions"""
      x = self.embedding(x)
  
      # If 2d tensor, add a time-axis
      # This is used for inference time (during beamforming)
      if len(x.shape) == 2:
          x = x.unsqueeze(dim=1)
          self.reshape = True
  
      x = x.transpose(0, 1)
      x, hidden = self.rnn(x, hx)
      x = x.transpose(0, 1)
      x = self.out(x)
      x = self.log_softmax(x)
  
      if self.reshape:
          x = x.squeeze(dim=1)
  
      if self.return_hidden:
          return x, hidden
      else:
          return x
  
imports: import torch
  import speechbrain
label_desc: Use image node_id 2 for calling the CustomModel obj's underlying member method code with example usage: obj.forward(x, hx) and returns: x,  hidden, x