Function marian::inits::fromWord2vec

Function Documentation

Ptr<NodeInitializer> marian::inits::fromWord2vec(const std::string &file, int dimVoc, int dimEmb, bool normalize = false)

Initialize tensor from a file.

Creates a NodeInitializer that will initialize the tensor by copying the values from the given file. This function is mainly used for loading embedding vectors from a file.


A NodeInitializer

  • file: filename

  • dimVoc: the number of words in the vocabulary

  • dimEmb: the length of embedding vectors

  • normalize: a flag holds whether the values are normalize. Here we adopt the method of scaling to unit length, i.e., dividing each element by the Euclidean length of the vector.