self.h = torch.randn(n_layer, batch_size, h_size).type(torch.ShortTensor)
But I was able to solve the problem. It turned out that it actually didnt need ShortTensor but float32. I think LSTM takes only float32. Everything else didn’t work for me.