📜  循环神经网络 pytorch - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:37.304000             🧑  作者: Mango

代码示例1
import torch
from torch import nn

# check documentation in the source link for further information
rnn = nn.RNN(10, 20, 2)

# initialize vectors at t=0
x = torch.randn(5, 3, 10) 
h0 = torch.randn(2, 3, 20) 

output, hn = rnn(x, h0)