Fix vector norm when loading lexemes.

This commit is contained in:
Matthew Honnibal 2016-10-23 19:40:18 +02:00
parent c05cd2356e
commit 6036ec7c77

View File

@ -449,6 +449,7 @@ cdef class Vocab:
lex = <LexemeC*>lex_addr
if lex.lower < vectors.size():
lex.vector = vectors[lex.lower]
norm = 0.0
for i in range(vec_len):
norm += lex.vector[i] * lex.vector[i]
lex.l2_norm = sqrt(norm)