I use model = LSTMModel.LSTMpred(1,40).to(device) to initialize my model, but when I try to train it, it’s just stuck on the code modelout = model(indata) and the whole program gets existed after a few seconds saying Process finished with exit code -1073741819 (0xC0000005).
However, when I initialize device to cpu, like device = torch.device('cpu') it starts to work
I’m confused about it, why does it happen? I would appreciate your help.
One thing I do see is model = LSTMModel.LSTMpred(1,40).to(device) does not move the self.hidden over to GPU, because it’s not registered as a parameter or a buffer.
I think you want to move self.initHidden() into the forward function, rather being in the constructor.