Treat  nn.Embedding  as a lookup table where the key is the word index and the value is the corresponding word vector. However, before using it you should specify the size of the lookup table, and initialize the word vectors.
Not all the weights are trained at the same time in this nn.Embedding. Weight training would depend on your training pairs.  For example, lets say (‘Bruce’ , ‘Wayne’) is a training pair. Assuming that ‘Bruce’ and ‘Wayne’ words are present in your vocabulary with indices 100 and 200(just an example), nn.Embedding would allow you to pick the untrained word vectors for these two indices. This these two vectors would be brought closer to each other, resulting in their training.
Remember nn.Embedding is a lookup table. You just need to give in the indices of the words , and it gives you the word vectors for those words.


You can have a look at this pytorch implementation of  Skip-Gram model 535


I hope it helped you !!!