Hi,
I am just wondering about how we should initialise the hidden/cell state of the LSTM if we want something different than just zeros. I usually do it like this (just using the example in the docs):
>>> rnn = nn.LSTM(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> c0 = torch.randn(2, 3, 20)
>>> output, (hn, cn) = rnn(input, (h0, c0))
But I have also seen examples that use Variable
or even the example mentioned here: Correct way to declare hidden and cell states of LSTM.
I suppose that Variable allows the model to “learn” a correct initialisation of the hidden state. Is that correct???