nn unit. Maps from word ids to embeddings. Slim wrapper around nn.LookupTable to allow fixed and pretrained embeddings.


onmt.WordEmbedding(vocabSize, vecSize, preTrained, fix)


  • vocabSize - size of the vocabulary
  • vecSize - size of the embedding
  • preTrainined - path to a pretrained vector file
  • fix - keep the weights of the embeddings fixed.

Undocumented methods

* onmt.WordEmbedding:postParametersInitialization() * onmt.WordEmbedding:accGradParameters(input, gradOutput, scale) * onmt.WordEmbedding:parameters()