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, *, split_gates=False)[исходный код] -
Квантуемая сеть долгой краткосрочной памяти (LSTM).
Описание и типы аргументов см. в разделе
LSTM- Переменные:
-
layers – экземпляры
_LSTMLayer
Примечание
Чтобы получить доступ к весам и смещениям, необходимо обращаться к ним по отдельности для каждого слоя. См. примеры ниже.
Примеры:
>>> 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
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.ao.nn.quantizable.LSTM.html