Hi, every one, I have a question about multi-layer bi-lstm. I define a 2-layers bi-lstm like this:
model = nn.LSTM(input_size, hidden_size, num_layers=2, bidirectional=True),
input = Variable(torch.randn(1, 1, input_size))
h0 = Variable(torch.randn(num_layers * 2 , 1, hidden_size))
c0 = Variable(torch.randn(num_layers * 2, 1, hidden_size))
hidden = (h0, c0)
output, hidden = model(output, hidden)
my question is that: how pytorch assign the h0 and c0 to the lstm, is that: h0[0], h0[1] assign to one direction and h0[2], h0[3] assign to another direction, or h0[0], h0[2] assign to one direction and h0[1], h0[3] assign to another direction, or other ways?
In the same way, how pytorch assign the sequence in the hidden?