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)