Function marian::inits::fromWord2vec¶
Defined in File node_initializers.cpp
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.
- Return
- Parameters
file
: filenamedimVoc
: the number of words in the vocabularydimEmb
: the length of embedding vectorsnormalize
: 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.