Hi,
Many thanks for your reply.
I have tried your suggestion that changed the code from:
h0 = Variable(torch.zeros(self.nb_layers_1, input.size()[1], self.hidden_size_1))
to
h0 = torch.ones(self.nb_layers_1, input.size()[1], self.hidden_size_1)
for both h0, h1, c0 and c1, however, the result was also shown a straight line.
Additional information, if I just use one layer of LSTM with 5 LSTM units, using the same code(by mean that initialization both the hidden state and cell state as zeros), it can be successfully predicted, but add one more single unit LSTM layer it doesn’t.