Input and hidden tensors are not at the same device, found input tensor at cuda:0 and hidden tensor at cpu
here is my code for lstm network, I instantiated it and passed to Cuda device but still getting the error that hidden and inputs are not in same device
class LSTM_net(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
    super(LSTM_net, self).__init__()
    self.hidden_size = hidden_size
    self.lstm_cell = nn.LSTM(input_size, hidden_size)
    self.h2o = nn.Linear(hidden_size, output_size)
    self.softmax = nn.LogSoftmax(dim=1)

def forward(self, input, hidden_0=None, hidden_1=None, hidden_2=None):
    input=resnet(input)
    input=input.unsqueeze(0)
    out_0, hidden_0 = self.lstm_cell(input, hidden_0)
    out_1, hidden_1 = self.lstm_cell(out_0+input, hidden_1)
    out_2, hidden_2 = self.lstm_cell(out_1+input, hidden_2)
    output = self.h2o(hidden_2[0].view(-1, self.hidden_size))
    output = self.softmax(output)
    return output,hidden_0,hidden_1, hidden_2 

def init_hidden(self, batch_size = 1):
    return (torch.zeros(1, batch_size, self.hidden_size), torch.zeros(1, batch_size, self.hidden_size))

net1=LSTM_net(input_size=1000,hidden_size=1000, output_size=100)

net1=net1.to(device)

pic of connections that I want to make, plz guide me to implement it
click here for an image of error massege

Edit: I think I see the problem now. Try changing
    def init_hidden(self, batch_size = 1):
        return (torch.zeros(1, batch_size, self.hidden_size), torch.zeros(1, batch_size, self.hidden_size))

to
    def init_hidden(self, batch_size = 1):
        return (torch.zeros(1, batch_size, self.hidden_size).cuda(), torch.zeros(1, batch_size, self.hidden_size).cuda())

This is because each of the tensors created by init_hidden method are not data attributes in the parent object of the function. So they do not have cuda() applied to them when you apply cuda() to an instance of the model object.
Try calling .cuda() on all the tensors/variables and models involved.
net1.cuda() # net1.to(device) for device == cuda:0 works fine also 
            # cuda() is more succinct, though
input.cuda()

# now, calling net1 on a tensor named input should not produce the error.
out = net1(input)

