評價此頁

LSTMCell#

class torch.ao.nn.quantized.dynamic.LSTMCell(*args, **kwargs)[原始碼]#

一個長短期記憶 (LSTM) 單元。

一個動態量化的 LSTMCell 模組,以浮點張量作為輸入和輸出。權重被量化為 8 位。我們採用與 torch.nn.LSTMCell 相同的介面,請參見 https://pytorch.com.tw/docs/stable/nn.html#torch.nn.LSTMCell 上的文件。

示例

>>> rnn = nn.LSTMCell(10, 20)
>>> input = torch.randn(6, 3, 10)
>>> hx = torch.randn(3, 20)
>>> cx = torch.randn(3, 20)
>>> output = []
>>> for i in range(6):
...     hx, cx = rnn(input[i], (hx, cx))
...     output.append(hx)