From 31ef7261060193389ee7ee91c0ae373eb93ab44e Mon Sep 17 00:00:00 2001 From: Marius Cobzarenco Date: Thu, 19 Oct 2017 15:06:44 +0100 Subject: [PATCH] Ensures FastText returns consistent dtypes --- gensim/models/wrappers/fasttext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gensim/models/wrappers/fasttext.py b/gensim/models/wrappers/fasttext.py index 76fdb0e34b..bfbb4986ee 100644 --- a/gensim/models/wrappers/fasttext.py +++ b/gensim/models/wrappers/fasttext.py @@ -90,7 +90,7 @@ def word_vec(self, word, use_norm=False): if word in self.vocab: return super(FastTextKeyedVectors, self).word_vec(word, use_norm) else: - word_vec = np.zeros(self.syn0_ngrams.shape[1]) + word_vec = np.zeros(self.syn0_ngrams.shape[1], dtype=np.float32) ngrams = compute_ngrams(word, self.min_n, self.max_n) ngrams = [ng for ng in ngrams if ng in self.ngrams] if use_norm: