RNNCell#
- class torch.ao.nn.quantized.dynamic.RNNCell(input_size, hidden_size, bias=True, nonlinearity='tanh', dtype=torch.qint8)[原始碼]#
具有 tanh 或 ReLU 非線性的 Elman RNN 單元。一個動態量化的 RNNCell 模組,具有浮點張量作為輸入和輸出。權重被量化為 8 位。我們採用與 torch.nn.RNNCell 相同的介面,有關文件請參閱 https://pytorch.com.tw/docs/stable/nn.html#torch.nn.RNNCell。
示例
>>> rnn = nn.RNNCell(10, 20) >>> input = torch.randn(6, 3, 10) >>> hx = torch.randn(3, 20) >>> output = [] >>> for i in range(6): ... hx = rnn(input[i], hx) ... output.append(hx)