@ptrblck  Thanks a lot. The parameters part is clear now. So if I do loss.backward(), all the parameters listed will update right?. What are the situations that I have to handle cuda assignments myself? (can you please share some links which explain this).
How can I run this model in multiple GPUs, do the following code work?
if torch.cuda.is_available:
    m=m.cuda()
    m = nn.DataParallel(m, device_ids=None)

If so, what modification I need to do in the get_embedding function to work in multiple gpus? (I mean what i need to put in place of .cuda(gpu_device). )
Thanks