How to train my model in GPU, but test in CPU?
net.eval()
net.cuda()
X = Variable(torch.from_numpy(x).float()).cuda()
Y = Variable(torch.from_numpy(y).long()).cuda()

If I remove .cuda()  I got an error: input is not contigous.
I also have tried this, and still get the same error:
# net new have the same architecture with net
net_new.load_state_dict(net.state_dict())
net_new.eval()
X = Variable(torch.from_numpy(x).float())
Y = Variable(torch.from_numpy(y).long())