Table of Contents
Shortcuts

# LSTM

class torch.ao.nn.quantizable.LSTM(input_size, hidden_size, num_layers=1, bias=True, batch_first=False, dropout=0.0, bidirectional=False, device=None, dtype=None)

  A quantizable long short-term memory (LSTM).

  For the description and the argument types, please, refer to `LSTM`

  Variables:

    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:
      >>> print(rnn.layers[0].weight_ih)
      tensor([[...]])
      >>> print(rnn.layers[0].weight_hh)
      AssertionError: There is no reverse path in the non-bidirectional layer

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.