I want to implement skip-gram in Pytroch, the model just like below:

Snipaste_2019-06-13_11-40-09.jpg618×677 38.9 KB

And my output size is (batch_size, context_size, vocab_size), but I have no idea about the target output’s size.
I use nn.NLLLoss().
And now, the output_size is torch.Size([64, 2, 1110]), 64 means the batch_size is 64, 2 means context_size is 2(output two words), 1110 means there are 1110 words totally.
And the target size is torch.Size([64, 2]), and it throws the error:

ValueError: Expected target size (64, 1110), got torch.Size([64, 2])

So, what is the correct target size.