HI, I meet a problem when adding a new NN Module. There are two LSTM in the new module and LSTM need initial hidden state h_0.
init_hidden = (Variable(torch.zeros(1, inputs.size(1), self.hiddenchannel)),
               Variable(torch.zeros(1, inputs.size(1), self.hiddenchannel)))

It worked when I run outputs = model(inputs) with CPU mode. However if I run model = model.cuda(), outputs = model(inputs) Then error occurs.
I modify h_0 as:
init_hidden = (Variable(torch.zeros(1, inputs.size(1), self.hiddenchannel).cuda()),
               Variable(torch.zeros(1, inputs.size(1), self.hiddenchannel).cuda()))

and run model = model.cuda(), outputs = model(inputs) It works correctly.
So how to init h_0 thus it works in CPU & GPU mode when running outputs = model(inputs) and model = model.cuda(), outputs = model(inputs)?
Thanks