I looked at all the variables that were created in model and guide. All of them were set to cuda . Finally, solved it by the following code.
torch.set_default_tensor_type('torch.cuda.FloatTensor')
Is there any disadvantage by doing this ? (Apart from not having any control over the choice of device )