I think you got your hidden state Variable with wrong dimensions. I haven’t executed your code, but I think it should be:
h0 = Variable(torch.zeros(self.num_layers, 1 ,self.hidden_size)) as it stands for num_layers, batch_size, hidden_size.
Regards