I am having trouble understanding how nn.LSTM deals with a 2D input. For the code below:
lstm = nn.LSTM(10, 5)
v1 = Variable(torch.randn(13,10))
v2 = Variable(torch.randn(4,13,10))
o1 = lstm(v1)
o2 = lstm(v2)
print(o1[0].size(), o2[0].size())

Output is:
torch.Size([13, 10, 5]) torch.Size([4, 13, 5])

I understand what’s happening in the case of v2. However, v1 is a 2D vector and its output is a 3D vector. What is nn.LSTM doing with v1? How do I interpret the output?