class_docstr: A quantizable long short-term memory (LSTM).
  
  For the description and the argument types, please, refer to :class:`~torch.nn.LSTM`
  
  Attributes:
      layers : instances of the `_LSTMLayer`
  
  .. note::
      To access the weights and biases, you need to access them per layer.
      See examples below.
  
  Examples::
  
      >>> import torch.ao.nn.quantizable as nnqa
      >>> rnn = nnqa.LSTM(10, 20, 2)
      >>> input = torch.randn(5, 3, 10)
      >>> h0 = torch.randn(2, 3, 20)
      >>> c0 = torch.randn(2, 3, 20)
      >>> output, (hn, cn) = rnn(input, (h0, c0))
      >>> # To get the weights:
      >>> # xdoctest: +SKIP
      >>> print(rnn.layers[0].weight_ih)
      tensor([[...]])
      >>> print(rnn.layers[0].weight_hh)
      AssertionError: There is no reverse path in the non-bidirectional layer
class_docstr_tok: ["A","quantizable","long","short-term","memory","(","LSTM",")",".","For","the","description","and","the","argument","types",",","please",",","refer","to",":","class",":","`","~torch.nn.LSTM","`","Attributes",":","layers",":","instances","of","the","`","_LSTMLayer","`","..","note",":",":","To","access","the","weights","and","biases",",","you","need","to","access","them","per","layer",".","See","examples","below",".","Examples",":",":",">",">",">","import","torch.ao.nn.quantizable","as","nnqa",">",">",">","rnn","=","nnqa.LSTM","(","10",",","20",",","2",")",">",">",">","input","=","torch.randn","(","5",",","3",",","10",")",">",">",">","h0","=","torch.randn","(","2",",","3",",","20",")",">",">",">","c0","=","torch.randn","(","2",",","3",",","20",")",">",">",">","output",",","(","hn",",","cn",")","=","rnn","(","input",",","(","h0",",","c0",")",")",">",">",">","#","To","get","the","weights",":",">",">",">","#","xdoctest",":","+SKIP",">",">",">","print","(","rnn.layers","[","0","]",".weight_ih",")","tensor","(","[","[","...","]","]",")",">",">",">","print","(","rnn.layers","[","0","]",".weight_hh",")","AssertionError",":","There","is","no","reverse","path","in","the","non-bidirectional","layer"]
code: def __init__(
      self,
      input_size: int,
      hidden_size: int,
      num_layers: int = 1,
      bias: bool = True,
      batch_first: bool = False,
      dropout: float = 0.0,
      bidirectional: bool = False,
      device=None,
      dtype=None,
  ) -> None:
      factory_kwargs = {"device": device, "dtype": dtype}
      super().__init__()
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.num_layers = num_layers
      self.bias = bias
      self.batch_first = batch_first
      self.dropout = float(dropout)
      self.bidirectional = bidirectional
      self.training = False  # We don't want to train using this module
      num_directions = 2 if bidirectional else 1
  
      if (
          not isinstance(dropout, numbers.Number)
          or not 0 <= dropout <= 1
          or isinstance(dropout, bool)
      ):
          raise ValueError(
              "dropout should be a number in range [0, 1] "
              "representing the probability of an element being "
              "zeroed"
          )
      if dropout > 0:
          warnings.warn(
              "dropout option for quantizable LSTM is ignored. "
              "If you are training, please, use nn.LSTM version "
              "followed by `prepare` step."
          )
          if num_layers == 1:
              warnings.warn(
                  "dropout option adds dropout after all but last "
                  "recurrent layer, so non-zero dropout expects "
                  f"num_layers greater than 1, but got dropout={dropout} "
                  f"and num_layers={num_layers}"
              )
  
      layers = [
          _LSTMLayer(
              self.input_size,
              self.hidden_size,
              self.bias,
              batch_first=False,
              bidirectional=self.bidirectional,
              **factory_kwargs,
          )
      ]
      for layer in range(1, num_layers):
          layers.append(
              _LSTMLayer(
                  self.hidden_size,
                  self.hidden_size,
                  self.bias,
                  batch_first=False,
                  bidirectional=self.bidirectional,
                  **factory_kwargs,
              )
          )
      self.layers = torch.nn.ModuleList(layers)
  
imports: import numbers
  from typing import Optional, Tuple
  import warnings
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 to create a new LSTM object from inherited base classes: torch.nn with example: obj = LSTM(input_size, hidden_size, num_layers, bias, batch_first, dropout, bidirectional, device, dtype)