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.org/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)
本页目录