RNNCell¶
- 類 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)