From e96798cfc1bffc608ba57b2297507dcd3062d7c0 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 10:41:53 +0200 Subject: [PATCH 01/13] Fixing the computation of the Word2Vec loss. This commit re-writes the computation of the loss for both CBOW and SG Word2Vec. The loss that is computed and reported is the running average NCE loss within the epoch. This means that for each new epoch, the counters are reset to 0, and the new average is computed. This was not the cas before, and the loss was incremented during the whole training, which is not very informative, beside being also incorrect in the implementation (see below) The computation of the word2vec loss was flawed in many ways: - race condition on the running_training_loss parameter (updated concurrently in a GIL-free portion of the code) - incorrect dividing factor for the average in the case of SG. The averaging factor in the case of SG should not be the effective words, but the effective samples (a new variable I introduce), because the loss is incremented as many times as there are positive examples that are sampled for an effective word. Addtionnally, I add the logging of the current value of the loss in the progress logger, when compute_loss is set to True, and I add a parameter to the word2vec_standalone script to trigger the reporting of the loss. --- gensim/models/base_any2vec.py | 101 +- gensim/models/word2vec.py | 13 +- gensim/models/word2vec_inner.c | 3488 ++++++++++++++----------- gensim/models/word2vec_inner.pyx | 21 +- gensim/scripts/word2vec_standalone.py | 7 +- 5 files changed, 2007 insertions(+), 1623 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index e6a31263ec..47434d6e11 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -75,7 +75,17 @@ def _clear_post_train(self): raise NotImplementedError() def _do_train_job(self, data_iterable, job_parameters, thread_private_mem): - """Train a single batch. Return 2-tuple `(effective word count, total word count)`.""" + """Train a single batch. Return 3-tuple + `(effective word count, total word count, total samples used)`. + + The total samples used is the same as the effective word count when + using CBOW, but it can differ with Skip-Gram, since a random number of + positve examples are used for each effective word. + + Knowing the effective number of samples used allows us to compute the + average loss for an epoch. + + """ raise NotImplementedError() def _check_training_sanity(self, epochs=None, total_examples=None, total_words=None, **kwargs): @@ -96,12 +106,15 @@ def _worker_loop(self, job_queue, progress_queue): for callback in self.callbacks: callback.on_batch_begin(self) - tally, raw_tally = self._do_train_job(data_iterable, job_parameters, thread_private_mem) + tally, raw_tally, effective_samples = self._do_train_job( + data_iterable, job_parameters, thread_private_mem) for callback in self.callbacks: callback.on_batch_end(self) - progress_queue.put((len(data_iterable), tally, raw_tally)) # report back progress + # report back progress + progress_queue.put( + (len(data_iterable), tally, raw_tally, effective_samples)) jobs_processed += 1 logger.debug("worker exiting, processed %i jobs", jobs_processed) @@ -154,7 +167,7 @@ def _job_producer(self, data_iterator, job_queue, cur_epoch=0, total_examples=No logger.debug("job loop exiting, total %i jobs", job_no) def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed): + raw_word_count, total_words, trained_word_count, total_samples, elapsed): raise NotImplementedError() def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, @@ -166,7 +179,7 @@ def _log_train_end(self, raw_word_count, trained_word_count, total_elapsed, job_ def _log_epoch_progress(self, progress_queue, job_queue, cur_epoch=0, total_examples=None, total_words=None, report_delay=1.0): - example_count, trained_word_count, raw_word_count = 0, 0, 0 + example_count, trained_word_count, raw_word_count, samples_count = 0, 0, 0, 0 start, next_report = default_timer() - 0.00001, 1.0 job_tally = 0 unfinished_worker_count = self.workers @@ -177,20 +190,20 @@ def _log_epoch_progress(self, progress_queue, job_queue, cur_epoch=0, total_exam unfinished_worker_count -= 1 logger.info("worker thread finished; awaiting finish of %i more threads", unfinished_worker_count) continue - examples, trained_words, raw_words = report + examples, trained_words, raw_words, effective_samples = report job_tally += 1 # update progress stats example_count += examples trained_word_count += trained_words # only words in vocab & sampled raw_word_count += raw_words - + samples_count += effective_samples # log progress once every report_delay seconds elapsed = default_timer() - start if elapsed >= next_report: self._log_progress( job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed) + raw_word_count, total_words, trained_word_count, samples_count, elapsed) next_report = elapsed + report_delay # all done; report the final stats elapsed = default_timer() - start @@ -202,7 +215,37 @@ def _log_epoch_progress(self, progress_queue, job_queue, cur_epoch=0, total_exam def _train_epoch(self, data_iterable, cur_epoch=0, total_examples=None, total_words=None, queue_factor=2, report_delay=1.0): - """Train one epoch.""" + + """Train the model for a single epoch. + + Parameters + ---------- + data_iterable : iterable of list of object + The input corpus. This will be split in chunks and these chunks will be pushed to the queue. + cur_epoch : int, optional + The current training epoch, needed to compute the training parameters for each job. + For example in many implementations the learning rate would be dropping with the number of epochs. + total_examples : int, optional + Count of objects in the `data_iterator`. In the usual case this would correspond to the number of sentences + in a corpus, used to log progress. + total_words : int, optional + Count of total objects in `data_iterator`. In the usual case this would correspond to the number of raw + words in a corpus, used to log progress. + queue_factor : int, optional + Multiplier for size of queue -> size = number of workers * queue_factor. + report_delay : float, optional + Number of seconds between two consecutive progress report messages in the logger. + + Returns + ------- + (int, int, int) + The training report for this epoch consisting of three elements: + * Size of data chunk processed, for example number of sentences in the corpus chunk. + * Effective word count used in training (after ignoring unknown words and trimming the sentence length). + * Total word count used in training. + + """ + self.running_training_loss = 0. job_queue = Queue(maxsize=queue_factor * self.workers) progress_queue = Queue(maxsize=(queue_factor + 1) * self.workers) @@ -641,21 +684,39 @@ def load(cls, *args, **kwargs): return model def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed): + raw_word_count, total_words, trained_word_count, total_samples, elapsed): + if total_samples == 0: + loss = -1 + else: + loss = self.get_latest_training_loss() / total_samples if total_examples: # examples-based progress % - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue) - ) + if self.compute_loss: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue), loss + ) + else: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i", + cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue) + ) else: # words-based progress % - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue) - ) + if self.compute_loss: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i", + cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue) + ) + else: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue), loss + ) def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, trained_word_count, elapsed): diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index 9539aa8d2c..0c7ce1d736 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -154,6 +154,7 @@ def train_batch_sg(model, sentences, alpha, work=None, compute_loss=False): will use the optimized version from word2vec_inner instead. """ result = 0 + effective_samples = 0 for sentence in sentences: word_vocabs = [model.wv.vocab[w] for w in sentence if w in model.wv.vocab and model.wv.vocab[w].sample_int > model.random.rand() * 2 ** 32] @@ -165,12 +166,13 @@ def train_batch_sg(model, sentences, alpha, work=None, compute_loss=False): for pos2, word2 in enumerate(word_vocabs[start:(pos + model.window + 1 - reduced_window)], start): # don't train on the `word` itself if pos2 != pos: + effective_samples += 1 train_sg_pair( model, model.wv.index2word[word.index], word2.index, alpha, compute_loss=compute_loss ) result += len(word_vocabs) - return result + return result, effective_samples def train_batch_cbow(model, sentences, alpha, work=None, neu1=None, compute_loss=False): """ @@ -194,7 +196,7 @@ def train_batch_cbow(model, sentences, alpha, work=None, neu1=None, compute_loss l1 /= len(word2_indices) train_cbow_pair(model, word, word2_indices, l1, alpha, compute_loss=compute_loss) result += len(word_vocabs) - return result + return result, result def score_sentence_sg(model, sentence, work=None): """ @@ -539,12 +541,11 @@ def _do_train_job(self, sentences, alpha, inits): ignoring unknown words and sentence length trimming, total word count)`. """ work, neu1 = inits - tally = 0 if self.sg: - tally += train_batch_sg(self, sentences, alpha, work, self.compute_loss) + (tally, effective_samples) = train_batch_sg(self, sentences, alpha, work, self.compute_loss) else: - tally += train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) - return tally, self._raw_word_count(sentences) + (tally, effective_samples) = train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) + return tally, self._raw_word_count(sentences), effective_samples def _clear_post_train(self): """Resets certain properties of the model, post training.""" diff --git a/gensim/models/word2vec_inner.c b/gensim/models/word2vec_inner.c index bdb21349a2..81b635ed6d 100644 --- a/gensim/models/word2vec_inner.c +++ b/gensim/models/word2vec_inner.c @@ -1,4 +1,22 @@ -/* Generated by Cython 0.27.3 */ +/* Generated by Cython 0.28.4 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "models/voidptr.h" + ], + "include_dirs": [ + "models" + ], + "name": "gensim.models.word2vec_inner", + "sources": [ + "/home/akhlif/dzr_core/gensim/gensim/models/word2vec_inner.pyx" + ] + }, + "module_name": "gensim.models.word2vec_inner" +} +END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,7 +25,7 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_27_3" +#define CYTHON_ABI "0_28_4" #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -183,6 +201,103 @@ #undef BASE #undef MASK #endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif @@ -211,12 +326,12 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args, + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast @@ -228,6 +343,18 @@ #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 @@ -237,6 +364,36 @@ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; // PyThread_create_key reports success always +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif // TSS (Thread Specific Storage) API #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -249,6 +406,11 @@ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ @@ -293,18 +455,6 @@ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 @@ -321,6 +471,7 @@ #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -332,7 +483,11 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -367,16 +522,10 @@ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -394,96 +543,6 @@ unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; - #endif - #endif -#else - #include -#endif -#ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] - #endif - #endif - #ifndef CYTHON_FALLTHROUGH - #if __has_attribute(fallthrough) - #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) - #else - #define CYTHON_FALLTHROUGH - #endif - #endif - #if defined(__clang__ ) && defined(__apple_build_version__) - #if __apple_build_version__ < 7000000 - #undef CYTHON_FALLTHROUGH - #define CYTHON_FALLTHROUGH - #endif - #endif -#endif - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES @@ -520,6 +579,7 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__gensim__models__word2vec_inner #define __PYX_HAVE_API__gensim__models__word2vec_inner +/* Early includes */ #include "voidptr.h" #include #include @@ -610,7 +670,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ @@ -718,7 +778,7 @@ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime; +static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -751,7 +811,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "gensim/models/word2vec_inner.pyx", + "models/word2vec_inner.pyx", "__init__.pxd", "type.pxd", }; @@ -768,7 +828,7 @@ static const char *__pyx_f[] = { #endif -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":743 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -777,7 +837,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":744 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -786,7 +846,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":745 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -795,7 +855,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":746 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -804,7 +864,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -813,7 +873,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -822,7 +882,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":752 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -831,7 +891,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -840,7 +900,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -849,7 +909,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -858,7 +918,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -867,7 +927,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -876,7 +936,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":756 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -885,7 +945,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -894,7 +954,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":772 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":759 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -903,7 +963,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -912,7 +972,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -921,7 +981,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":763 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -930,7 +990,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -939,7 +999,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -948,7 +1008,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -992,7 +1052,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do /*--- Type declarations ---*/ -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1001,7 +1061,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1010,7 +1070,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1019,7 +1079,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1166,16 +1226,7 @@ typedef void (*__pyx_t_6gensim_6models_14word2vec_inner_our_saxpy_ptr)(int const /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif @@ -1211,6 +1262,35 @@ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* s return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* ObjectGetItem.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); +#else +#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) +#endif + /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ @@ -1231,17 +1311,8 @@ static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObje /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) @@ -1286,25 +1357,23 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); - } - return NULL; - } - Py_INCREF(value); - return value; -} +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else - #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif /* RaiseTooManyValuesToUnpack.proto */ @@ -1352,14 +1421,6 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); @@ -1532,6 +1593,7 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -1720,6 +1782,7 @@ static const char __pyx_k_train_batch_sg[] = "train_batch_sg"; static const char __pyx_k_effective_words[] = "effective_words"; static const char __pyx_k_reduced_windows[] = "reduced_windows"; static const char __pyx_k_train_batch_cbow[] = "train_batch_cbow"; +static const char __pyx_k_effective_samples[] = "effective_samples"; static const char __pyx_k_scipy_linalg_blas[] = "scipy.linalg.blas"; static const char __pyx_k_score_sentence_sg[] = "score_sentence_sg"; static const char __pyx_k_MAX_WORDS_IN_BATCH[] = "MAX_WORDS_IN_BATCH"; @@ -1728,13 +1791,14 @@ static const char __pyx_k_effective_sentences[] = "effective_sentences"; static const char __pyx_k_score_sentence_cbow[] = "score_sentence_cbow"; static const char __pyx_k_running_training_loss[] = "running_training_loss"; static const char __pyx_k_running_training_loss_2[] = "_running_training_loss"; +static const char __pyx_k_models_word2vec_inner_pyx[] = "models/word2vec_inner.pyx"; static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_gensim_models_word2vec_inner[] = "gensim.models.word2vec_inner"; +static const char __pyx_k_running_training_loss_sample[] = "_running_training_loss_sample"; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; -static const char __pyx_k_gensim_models_word2vec_inner_pyx[] = "gensim/models/word2vec_inner.pyx"; static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; @@ -1763,6 +1827,7 @@ static PyObject *__pyx_n_s_cum_table; static PyObject *__pyx_n_s_cum_table_len; static PyObject *__pyx_n_s_d_res; static PyObject *__pyx_n_s_dsdot; +static PyObject *__pyx_n_s_effective_samples; static PyObject *__pyx_n_s_effective_sentences; static PyObject *__pyx_n_s_effective_words; static PyObject *__pyx_n_s_enumerate; @@ -1770,7 +1835,6 @@ static PyObject *__pyx_n_s_expected; static PyObject *__pyx_n_s_fblas; static PyObject *__pyx_n_s_float32; static PyObject *__pyx_n_s_gensim_models_word2vec_inner; -static PyObject *__pyx_kp_s_gensim_models_word2vec_inner_pyx; static PyObject *__pyx_n_s_hs; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_idx_end; @@ -1784,6 +1848,7 @@ static PyObject *__pyx_n_s_j; static PyObject *__pyx_n_s_k; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_model; +static PyObject *__pyx_kp_s_models_word2vec_inner_pyx; static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_negative; @@ -1807,6 +1872,7 @@ static PyObject *__pyx_n_s_reduced_windows; static PyObject *__pyx_n_s_result; static PyObject *__pyx_n_s_running_training_loss; static PyObject *__pyx_n_s_running_training_loss_2; +static PyObject *__pyx_n_s_running_training_loss_sample; static PyObject *__pyx_n_s_sample; static PyObject *__pyx_n_s_sample_int; static PyObject *__pyx_n_s_saxpy; @@ -1882,6 +1948,7 @@ static PyObject *__pyx_codeobj__18; static PyObject *__pyx_codeobj__20; static PyObject *__pyx_codeobj__22; static PyObject *__pyx_codeobj__24; +/* Late includes */ /* "gensim/models/word2vec_inner.pyx":46 * @@ -2078,9 +2145,10 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_v_f_dot; __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_v_lprob; int __pyx_t_1; - PY_LONG_LONG __pyx_t_2; - int __pyx_t_3; + int __pyx_t_2; + PY_LONG_LONG __pyx_t_3; int __pyx_t_4; + int __pyx_t_5; /* "gensim/models/word2vec_inner.pyx":77 * @@ -2098,7 +2166,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t * for b in range(codelen): * row2 = word_point[b] * size */ - memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":81 * @@ -2108,8 +2176,9 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t * f_dot = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) */ __pyx_t_1 = __pyx_v_codelen; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_b = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_b = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":82 * memset(work, 0, size * cython.sizeof(REAL_t)) @@ -2136,16 +2205,16 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t * continue * f = EXP_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L6_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L6_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":85 * f_dot = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) @@ -2190,8 +2259,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * lprob = -1*sgn*f_dot */ - __pyx_t_3 = ((__pyx_v__compute_loss == 1) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v__compute_loss == 1) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":90 * @@ -2218,16 +2287,16 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs(__pyx_t * continue * lprob = LOG_TABLE[((lprob + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_lprob <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_lprob <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L10_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_lprob >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_lprob >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L10_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":93 * lprob = -1*sgn*f_dot @@ -2486,10 +2555,11 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente int __pyx_v_d; unsigned PY_LONG_LONG __pyx_r; long __pyx_t_1; - int __pyx_t_2; + long __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_t_5; + int __pyx_t_5; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_t_6; /* "gensim/models/word2vec_inner.pyx":129 * @@ -2516,7 +2586,7 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * * for d in range(negative+1): */ - memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":137 * memset(work, 0, size * cython.sizeof(REAL_t)) @@ -2526,8 +2596,9 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * target_index = word_index */ __pyx_t_1 = (__pyx_v_negative + 1); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_d = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_d = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":138 * @@ -2536,8 +2607,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * target_index = word_index * label = ONEF */ - __pyx_t_3 = ((__pyx_v_d == 0) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_d == 0) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":139 * for d in range(negative+1): @@ -2593,8 +2664,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * label = 0.0 */ - __pyx_t_3 = ((__pyx_v_target_index == __pyx_v_word_index) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_target_index == __pyx_v_word_index) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":145 * next_random = (next_random * 25214903917ULL + 11) & modulo @@ -2650,16 +2721,16 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * f = EXP_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L8_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L8_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":151 * f_dot = our_dot(&size, &syn0[row1], &ONE, &syn1neg[row2], &ONE) @@ -2704,8 +2775,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * f_dot = (f_dot if d == 0 else -f_dot) * if f_dot <= -MAX_EXP or f_dot >= MAX_EXP: */ - __pyx_t_3 = ((__pyx_v__compute_loss == 1) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v__compute_loss == 1) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":156 * @@ -2715,11 +2786,11 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue */ if (((__pyx_v_d == 0) != 0)) { - __pyx_t_5 = __pyx_v_f_dot; + __pyx_t_6 = __pyx_v_f_dot; } else { - __pyx_t_5 = (-__pyx_v_f_dot); + __pyx_t_6 = (-__pyx_v_f_dot); } - __pyx_v_f_dot = __pyx_t_5; + __pyx_v_f_dot = __pyx_t_6; /* "gensim/models/word2vec_inner.pyx":157 * if _compute_loss == 1: @@ -2728,16 +2799,16 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * log_e_f_dot = LOG_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L12_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L12_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":158 * f_dot = (f_dot if d == 0 else -f_dot) @@ -2858,8 +2929,9 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - PY_LONG_LONG __pyx_t_4; - int __pyx_t_5; + int __pyx_t_4; + PY_LONG_LONG __pyx_t_5; + int __pyx_t_6; /* "gensim/models/word2vec_inner.pyx":179 * cdef long long a, b @@ -2877,7 +2949,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * count = 0.0 * for m in range(j, k): */ - memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":183 * @@ -2896,8 +2968,9 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue */ __pyx_t_1 = __pyx_v_k; - for (__pyx_t_2 = __pyx_v_j; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_m = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_m = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":185 * count = 0.0 @@ -2906,8 +2979,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue * else: */ - __pyx_t_3 = ((__pyx_v_m == __pyx_v_i) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_m == __pyx_v_i) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":186 * for m in range(j, k): @@ -2956,8 +3029,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * inv_count = ONEF/count * if cbow_mean: */ - __pyx_t_3 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":191 * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) @@ -2984,8 +3057,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * sscal(&size, &inv_count, neu1, &ONE) # (does this need BLAS-variants like saxpy?) * */ - __pyx_t_3 = (__pyx_v_cbow_mean != 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_cbow_mean != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":193 * inv_count = ONEF/count @@ -3012,7 +3085,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * for b in range(codelens[i]): * row2 = word_point[b] * size */ - memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":196 * @@ -3022,8 +3095,9 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * f_dot = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) */ __pyx_t_1 = (__pyx_v_codelens[__pyx_v_i]); - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { - __pyx_v_b = __pyx_t_4; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_2; __pyx_t_5+=1) { + __pyx_v_b = __pyx_t_5; /* "gensim/models/word2vec_inner.pyx":197 * memset(work, 0, size * cython.sizeof(REAL_t)) @@ -3050,16 +3124,16 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue * f = EXP_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_5) { + __pyx_t_6 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_6) { } else { - __pyx_t_3 = __pyx_t_5; + __pyx_t_4 = __pyx_t_6; goto __pyx_L11_bool_binop_done; } - __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_5; + __pyx_t_6 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_6; __pyx_L11_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":200 * f_dot = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) @@ -3104,8 +3178,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * lprob = -1*sgn*f_dot */ - __pyx_t_3 = ((__pyx_v__compute_loss == 1) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v__compute_loss == 1) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":205 * @@ -3132,16 +3206,16 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue * lprob = LOG_TABLE[((lprob + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_5 = ((__pyx_v_lprob <= -6.0) != 0); - if (!__pyx_t_5) { + __pyx_t_6 = ((__pyx_v_lprob <= -6.0) != 0); + if (!__pyx_t_6) { } else { - __pyx_t_3 = __pyx_t_5; + __pyx_t_4 = __pyx_t_6; goto __pyx_L15_bool_binop_done; } - __pyx_t_5 = ((__pyx_v_lprob >= 6.0) != 0); - __pyx_t_3 = __pyx_t_5; + __pyx_t_6 = ((__pyx_v_lprob >= 6.0) != 0); + __pyx_t_4 = __pyx_t_6; __pyx_L15_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":208 * lprob = -1*sgn*f_dot @@ -3215,8 +3289,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * sscal(&size, &inv_count, work, &ONE) # (does this need BLAS-variants like saxpy?) * */ - __pyx_t_3 = ((!(__pyx_v_cbow_mean != 0)) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((!(__pyx_v_cbow_mean != 0)) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":216 * @@ -3244,8 +3318,9 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue */ __pyx_t_1 = __pyx_v_k; - for (__pyx_t_2 = __pyx_v_j; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_m = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_m = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":219 * @@ -3254,8 +3329,8 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs(__pyx * continue * else: */ - __pyx_t_3 = ((__pyx_v_m == __pyx_v_i) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_m == __pyx_v_i) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":220 * for m in range(j, k): @@ -3325,9 +3400,11 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - long __pyx_t_4; - int __pyx_t_5; - __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_t_6; + int __pyx_t_4; + long __pyx_t_5; + long __pyx_t_6; + int __pyx_t_7; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_t_8; /* "gensim/models/word2vec_inner.pyx":234 * cdef long long a @@ -3363,7 +3440,7 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * count = 0.0 * for m in range(j, k): */ - memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":242 * @@ -3382,8 +3459,9 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue */ __pyx_t_1 = __pyx_v_k; - for (__pyx_t_2 = __pyx_v_j; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_m = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_m = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":244 * count = 0.0 @@ -3392,8 +3470,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * else: */ - __pyx_t_3 = ((__pyx_v_m == __pyx_v_i) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_m == __pyx_v_i) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":245 * for m in range(j, k): @@ -3442,8 +3520,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * inv_count = ONEF/count * if cbow_mean: */ - __pyx_t_3 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":250 * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) @@ -3470,8 +3548,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * sscal(&size, &inv_count, neu1, &ONE) # (does this need BLAS-variants like saxpy?) * */ - __pyx_t_3 = (__pyx_v_cbow_mean != 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_cbow_mean != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":252 * inv_count = ONEF/count @@ -3498,7 +3576,7 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * * for d in range(negative+1): */ - memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_work, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); /* "gensim/models/word2vec_inner.pyx":256 * memset(work, 0, size * cython.sizeof(REAL_t)) @@ -3507,8 +3585,9 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * if d == 0: * target_index = word_index */ - __pyx_t_4 = (__pyx_v_negative + 1); - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { + __pyx_t_5 = (__pyx_v_negative + 1); + __pyx_t_6 = __pyx_t_5; + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_6; __pyx_t_1+=1) { __pyx_v_d = __pyx_t_1; /* "gensim/models/word2vec_inner.pyx":257 @@ -3518,8 +3597,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * target_index = word_index * label = ONEF */ - __pyx_t_3 = ((__pyx_v_d == 0) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_d == 0) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":258 * for d in range(negative+1): @@ -3575,8 +3654,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * label = 0.0 */ - __pyx_t_3 = ((__pyx_v_target_index == __pyx_v_word_index) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_target_index == __pyx_v_word_index) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":264 * next_random = (next_random * 25214903917ULL + 11) & modulo @@ -3632,16 +3711,16 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * f = EXP_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_7) { } else { - __pyx_t_3 = __pyx_t_5; + __pyx_t_4 = __pyx_t_7; goto __pyx_L13_bool_binop_done; } - __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_5; + __pyx_t_7 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_7; __pyx_L13_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":270 * f_dot = our_dot(&size, neu1, &ONE, &syn1neg[row2], &ONE) @@ -3686,8 +3765,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * f_dot = (f_dot if d == 0 else -f_dot) * if f_dot <= -MAX_EXP or f_dot >= MAX_EXP: */ - __pyx_t_3 = ((__pyx_v__compute_loss == 1) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v__compute_loss == 1) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":275 * @@ -3697,11 +3776,11 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue */ if (((__pyx_v_d == 0) != 0)) { - __pyx_t_6 = __pyx_v_f_dot; + __pyx_t_8 = __pyx_v_f_dot; } else { - __pyx_t_6 = (-__pyx_v_f_dot); + __pyx_t_8 = (-__pyx_v_f_dot); } - __pyx_v_f_dot = __pyx_t_6; + __pyx_v_f_dot = __pyx_t_8; /* "gensim/models/word2vec_inner.pyx":276 * if _compute_loss == 1: @@ -3710,16 +3789,16 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * log_e_f_dot = LOG_TABLE[((f_dot + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_5 = ((__pyx_v_f_dot <= -6.0) != 0); - if (!__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_f_dot <= -6.0) != 0); + if (!__pyx_t_7) { } else { - __pyx_t_3 = __pyx_t_5; + __pyx_t_4 = __pyx_t_7; goto __pyx_L17_bool_binop_done; } - __pyx_t_5 = ((__pyx_v_f_dot >= 6.0) != 0); - __pyx_t_3 = __pyx_t_5; + __pyx_t_7 = ((__pyx_v_f_dot >= 6.0) != 0); + __pyx_t_4 = __pyx_t_7; __pyx_L17_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":277 * f_dot = (f_dot if d == 0 else -f_dot) @@ -3793,8 +3872,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * sscal(&size, &inv_count, work, &ONE) # (does this need BLAS-variants like saxpy?) * */ - __pyx_t_3 = ((!(__pyx_v_cbow_mean != 0)) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((!(__pyx_v_cbow_mean != 0)) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":285 * @@ -3822,8 +3901,9 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue */ __pyx_t_1 = __pyx_v_k; - for (__pyx_t_2 = __pyx_v_j; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_m = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_m = __pyx_t_3; /* "gensim/models/word2vec_inner.pyx":288 * @@ -3832,8 +3912,8 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_fast_sente * continue * else: */ - __pyx_t_3 = ((__pyx_v_m == __pyx_v_i) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_m == __pyx_v_i) != 0); + if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":289 * for m in range(j,k): @@ -3932,29 +4012,29 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_1train_batch_sg(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 1); __PYX_ERR(0, 296, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 2); __PYX_ERR(0, 296, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 3); __PYX_ERR(0, 296, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 4); __PYX_ERR(0, 296, __pyx_L3_error) } @@ -4013,6 +4093,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON int __pyx_v_k; int __pyx_v_effective_words; int __pyx_v_effective_sentences; + int __pyx_v_effective_samples; int __pyx_v_sent_idx; int __pyx_v_idx_start; int __pyx_v_idx_end; @@ -4028,6 +4109,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON PyObject *__pyx_v_token = NULL; PyObject *__pyx_v_word = NULL; PyObject *__pyx_v_item = NULL; + CYTHON_UNUSED long __pyx_v__running_training_loss_sample; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4052,6 +4134,9 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; __Pyx_RefNannySetupContext("train_batch_sg", 0); /* "gensim/models/word2vec_inner.pyx":297 @@ -4085,7 +4170,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * cdef int negative = model.negative * cdef int sample = (model.vocabulary.sample != 0) # <<<<<<<<<<<<<< * - * cdef int _compute_loss = (1 if compute_loss == True else 0) + * cdef int _compute_loss = (1 if compute_loss is True else 0) */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -4101,14 +4186,12 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON /* "gensim/models/word2vec_inner.pyx":301 * cdef int sample = (model.vocabulary.sample != 0) * - * cdef int _compute_loss = (1 if compute_loss == True else 0) # <<<<<<<<<<<<<< - * cdef REAL_t _running_training_loss = model.running_training_loss + * cdef int _compute_loss = (1 if compute_loss is True else 0) # <<<<<<<<<<<<<< + * cdef REAL_t _running_training_loss = 0 * */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_compute_loss, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + __pyx_t_4 = (__pyx_v_compute_loss == Py_True); + if ((__pyx_t_4 != 0)) { __pyx_t_2 = 1; } else { __pyx_t_2 = 0; @@ -4117,19 +4200,15 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON /* "gensim/models/word2vec_inner.pyx":302 * - * cdef int _compute_loss = (1 if compute_loss == True else 0) - * cdef REAL_t _running_training_loss = model.running_training_loss # <<<<<<<<<<<<<< + * cdef int _compute_loss = (1 if compute_loss is True else 0) + * cdef REAL_t _running_training_loss = 0 # <<<<<<<<<<<<<< * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v__running_training_loss = __pyx_t_5; + __pyx_v__running_training_loss = 0.0; /* "gensim/models/word2vec_inner.pyx":304 - * cdef REAL_t _running_training_loss = model.running_training_loss + * cdef REAL_t _running_training_loss = 0 * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) @@ -4202,12 +4281,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON /* "gensim/models/word2vec_inner.pyx":317 * * cdef int i, j, k - * cdef int effective_words = 0, effective_sentences = 0 # <<<<<<<<<<<<<< + * cdef int effective_words = 0, effective_sentences = 0, effective_samples = 0 # <<<<<<<<<<<<<< * cdef int sent_idx, idx_start, idx_end * */ __pyx_v_effective_words = 0; __pyx_v_effective_sentences = 0; + __pyx_v_effective_samples = 0; /* "gensim/models/word2vec_inner.pyx":332 * cdef unsigned long long next_random @@ -4542,7 +4622,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON */ __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) if ((__pyx_t_7 != 0)) { - __pyx_t_13 = PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 352, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_1 = __pyx_t_13; __pyx_t_13 = 0; @@ -4961,8 +5041,9 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * idx_end = sentence_idx[sent_idx + 1] */ __pyx_t_2 = __pyx_v_effective_sentences; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_2; __pyx_t_17+=1) { - __pyx_v_sent_idx = __pyx_t_17; + __pyx_t_17 = __pyx_t_2; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) { + __pyx_v_sent_idx = __pyx_t_19; /* "gensim/models/word2vec_inner.pyx":382 * with nogil: @@ -4989,9 +5070,10 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * j = i - window + reduced_windows[i] * if j < idx_start: */ - __pyx_t_19 = __pyx_v_idx_end; - for (__pyx_t_20 = __pyx_v_idx_start; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_i = __pyx_t_20; + __pyx_t_20 = __pyx_v_idx_end; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = __pyx_v_idx_start; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_i = __pyx_t_22; /* "gensim/models/word2vec_inner.pyx":385 * idx_end = sentence_idx[sent_idx + 1] @@ -5044,7 +5126,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + window + 1 - reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< * k = idx_end - * for j in range(j, k): + * _running_training_loss_sample = 0 */ __pyx_t_4 = ((__pyx_v_k > __pyx_v_idx_end) != 0); if (__pyx_t_4) { @@ -5053,8 +5135,8 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + window + 1 - reduced_windows[i] * if k > idx_end: * k = idx_end # <<<<<<<<<<<<<< + * _running_training_loss_sample = 0 * for j in range(j, k): - * if j == i: */ __pyx_v_k = __pyx_v_idx_end; @@ -5063,52 +5145,71 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + window + 1 - reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< * k = idx_end - * for j in range(j, k): + * _running_training_loss_sample = 0 */ } /* "gensim/models/word2vec_inner.pyx":391 * if k > idx_end: * k = idx_end + * _running_training_loss_sample = 0 # <<<<<<<<<<<<<< + * for j in range(j, k): + * if j == i: + */ + __pyx_v__running_training_loss_sample = 0; + + /* "gensim/models/word2vec_inner.pyx":392 + * k = idx_end + * _running_training_loss_sample = 0 * for j in range(j, k): # <<<<<<<<<<<<<< * if j == i: * continue */ - __pyx_t_21 = __pyx_v_k; - for (__pyx_t_22 = __pyx_v_j; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { - __pyx_v_j = __pyx_t_22; + __pyx_t_23 = __pyx_v_k; + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_25 = __pyx_v_j; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) { + __pyx_v_j = __pyx_t_25; - /* "gensim/models/word2vec_inner.pyx":392 - * k = idx_end + /* "gensim/models/word2vec_inner.pyx":393 + * _running_training_loss_sample = 0 * for j in range(j, k): * if j == i: # <<<<<<<<<<<<<< * continue - * if hs: + * effective_samples += 1 */ __pyx_t_4 = ((__pyx_v_j == __pyx_v_i) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":393 + /* "gensim/models/word2vec_inner.pyx":394 * for j in range(j, k): * if j == i: * continue # <<<<<<<<<<<<<< + * effective_samples += 1 * if hs: - * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) */ goto __pyx_L31_continue; - /* "gensim/models/word2vec_inner.pyx":392 - * k = idx_end + /* "gensim/models/word2vec_inner.pyx":393 + * _running_training_loss_sample = 0 * for j in range(j, k): * if j == i: # <<<<<<<<<<<<<< * continue - * if hs: + * effective_samples += 1 */ } - /* "gensim/models/word2vec_inner.pyx":394 + /* "gensim/models/word2vec_inner.pyx":395 * if j == i: * continue + * effective_samples += 1 # <<<<<<<<<<<<<< + * if hs: + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + */ + __pyx_v_effective_samples = (__pyx_v_effective_samples + 1); + + /* "gensim/models/word2vec_inner.pyx":396 + * continue + * effective_samples += 1 * if hs: # <<<<<<<<<<<<<< * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) * if negative: @@ -5116,8 +5217,8 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON __pyx_t_4 = (__pyx_v_hs != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":395 - * continue + /* "gensim/models/word2vec_inner.pyx":397 + * effective_samples += 1 * if hs: * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< * if negative: @@ -5125,40 +5226,40 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON */ __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_hs((__pyx_v_points[__pyx_v_i]), (__pyx_v_codes[__pyx_v_i]), (__pyx_v_codelens[__pyx_v_i]), __pyx_v_syn0, __pyx_v_syn1, __pyx_v_size, (__pyx_v_indexes[__pyx_v_j]), __pyx_v__alpha, __pyx_v_work, __pyx_v_word_locks, __pyx_v__compute_loss, (&__pyx_v__running_training_loss)); - /* "gensim/models/word2vec_inner.pyx":394 - * if j == i: + /* "gensim/models/word2vec_inner.pyx":396 * continue + * effective_samples += 1 * if hs: # <<<<<<<<<<<<<< * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) * if negative: */ } - /* "gensim/models/word2vec_inner.pyx":396 + /* "gensim/models/word2vec_inner.pyx":398 * if hs: * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) * if negative: # <<<<<<<<<<<<<< * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) - * + * model.running_training_loss += _running_training_loss */ __pyx_t_4 = (__pyx_v_negative != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":397 + /* "gensim/models/word2vec_inner.pyx":399 * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) * if negative: * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< - * - * model.running_training_loss = _running_training_loss + * model.running_training_loss += _running_training_loss + * return effective_words, effective_samples */ __pyx_v_next_random = __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_sg_neg(__pyx_v_negative, __pyx_v_cum_table, __pyx_v_cum_table_len, __pyx_v_syn0, __pyx_v_syn1neg, __pyx_v_size, (__pyx_v_indexes[__pyx_v_i]), (__pyx_v_indexes[__pyx_v_j]), __pyx_v__alpha, __pyx_v_work, __pyx_v_next_random, __pyx_v_word_locks, __pyx_v__compute_loss, (&__pyx_v__running_training_loss)); - /* "gensim/models/word2vec_inner.pyx":396 + /* "gensim/models/word2vec_inner.pyx":398 * if hs: * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) * if negative: # <<<<<<<<<<<<<< * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) - * + * model.running_training_loss += _running_training_loss */ } __pyx_L31_continue:; @@ -5186,28 +5287,44 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON } } - /* "gensim/models/word2vec_inner.pyx":399 + /* "gensim/models/word2vec_inner.pyx":400 + * if negative: * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) - * - * model.running_training_loss = _running_training_loss # <<<<<<<<<<<<<< - * return effective_words + * model.running_training_loss += _running_training_loss # <<<<<<<<<<<<<< + * return effective_words, effective_samples * */ - __pyx_t_14 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 400, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_14) < 0) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_18) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - /* "gensim/models/word2vec_inner.pyx":400 - * - * model.running_training_loss = _running_training_loss - * return effective_words # <<<<<<<<<<<<<< + /* "gensim/models/word2vec_inner.pyx":401 + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) + * model.running_training_loss += _running_training_loss + * return effective_words, effective_samples # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 400, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_effective_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __pyx_t_18 = 0; + __pyx_t_3 = 0; __pyx_r = __pyx_t_14; __pyx_t_14 = 0; goto __pyx_L0; @@ -5241,7 +5358,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON return __pyx_r; } -/* "gensim/models/word2vec_inner.pyx":403 +/* "gensim/models/word2vec_inner.pyx":404 * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< @@ -5287,41 +5404,41 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_3train_batch_cbow(PyO kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 1); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 1); __PYX_ERR(0, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 2); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 2); __PYX_ERR(0, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 3); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 3); __PYX_ERR(0, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 4); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 4); __PYX_ERR(0, 404, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: - if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; + if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 5); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 5); __PYX_ERR(0, 404, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_batch_cbow") < 0)) __PYX_ERR(0, 403, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_batch_cbow") < 0)) __PYX_ERR(0, 404, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -5342,7 +5459,7 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_3train_batch_cbow(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 403, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 404, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.train_batch_cbow", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5415,167 +5532,163 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject *__pyx_t_18 = NULL; int __pyx_t_19; int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; __Pyx_RefNannySetupContext("train_batch_cbow", 0); - /* "gensim/models/word2vec_inner.pyx":404 + /* "gensim/models/word2vec_inner.pyx":405 * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): * cdef int hs = model.hs # <<<<<<<<<<<<<< * cdef int negative = model.negative * cdef int sample = (model.vocabulary.sample != 0) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_hs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_hs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_hs = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":405 + /* "gensim/models/word2vec_inner.pyx":406 * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): * cdef int hs = model.hs * cdef int negative = model.negative # <<<<<<<<<<<<<< * cdef int sample = (model.vocabulary.sample != 0) * cdef int cbow_mean = model.cbow_mean */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_negative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_negative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_negative = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":406 + /* "gensim/models/word2vec_inner.pyx":407 * cdef int hs = model.hs * cdef int negative = model.negative * cdef int sample = (model.vocabulary.sample != 0) # <<<<<<<<<<<<<< * cdef int cbow_mean = model.cbow_mean * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sample = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":407 + /* "gensim/models/word2vec_inner.pyx":408 * cdef int negative = model.negative * cdef int sample = (model.vocabulary.sample != 0) * cdef int cbow_mean = model.cbow_mean # <<<<<<<<<<<<<< * - * cdef int _compute_loss = (1 if compute_loss == True else 0) + * cdef int _compute_loss = (1 if compute_loss is True else 0) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cbow_mean = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":409 + /* "gensim/models/word2vec_inner.pyx":410 * cdef int cbow_mean = model.cbow_mean * - * cdef int _compute_loss = (1 if compute_loss == True else 0) # <<<<<<<<<<<<<< - * cdef REAL_t _running_training_loss = model.running_training_loss + * cdef int _compute_loss = (1 if compute_loss is True else 0) # <<<<<<<<<<<<<< + * cdef REAL_t _running_training_loss = 0 * */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_compute_loss, Py_True, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + __pyx_t_4 = (__pyx_v_compute_loss == Py_True); + if ((__pyx_t_4 != 0)) { __pyx_t_2 = 1; } else { __pyx_t_2 = 0; } __pyx_v__compute_loss = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":410 + /* "gensim/models/word2vec_inner.pyx":411 * - * cdef int _compute_loss = (1 if compute_loss == True else 0) - * cdef REAL_t _running_training_loss = model.running_training_loss # <<<<<<<<<<<<<< + * cdef int _compute_loss = (1 if compute_loss is True else 0) + * cdef REAL_t _running_training_loss = 0 # <<<<<<<<<<<<<< * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 410, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v__running_training_loss = __pyx_t_5; + __pyx_v__running_training_loss = 0.0; - /* "gensim/models/word2vec_inner.pyx":412 - * cdef REAL_t _running_training_loss = model.running_training_loss + /* "gensim/models/word2vec_inner.pyx":413 + * cdef REAL_t _running_training_loss = 0 * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) * cdef REAL_t *work */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 412, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 413, __pyx_L1_error) __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":413 + /* "gensim/models/word2vec_inner.pyx":414 * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) # <<<<<<<<<<<<<< * cdef REAL_t *work * cdef REAL_t _alpha = alpha */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vectors_lockf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vectors_lockf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 413, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 414, __pyx_L1_error) __pyx_v_word_locks = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":415 + /* "gensim/models/word2vec_inner.pyx":416 * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) * cdef REAL_t *work * cdef REAL_t _alpha = alpha # <<<<<<<<<<<<<< * cdef int size = model.wv.vector_size * */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_alpha); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_alpha); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error) __pyx_v__alpha = __pyx_t_5; - /* "gensim/models/word2vec_inner.pyx":416 + /* "gensim/models/word2vec_inner.pyx":417 * cdef REAL_t *work * cdef REAL_t _alpha = alpha * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< * * cdef int codelens[MAX_SENTENCE_LEN] */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_size = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":422 + /* "gensim/models/word2vec_inner.pyx":423 * cdef np.uint32_t reduced_windows[MAX_SENTENCE_LEN] * cdef int sentence_idx[MAX_SENTENCE_LEN + 1] * cdef int window = model.window # <<<<<<<<<<<<<< * * cdef int i, j, k */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 422, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_window = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":425 + /* "gensim/models/word2vec_inner.pyx":426 * * cdef int i, j, k * cdef int effective_words = 0, effective_sentences = 0 # <<<<<<<<<<<<<< @@ -5585,7 +5698,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_v_effective_words = 0; __pyx_v_effective_sentences = 0; - /* "gensim/models/word2vec_inner.pyx":440 + /* "gensim/models/word2vec_inner.pyx":441 * cdef unsigned long long next_random * * if hs: # <<<<<<<<<<<<<< @@ -5595,23 +5708,23 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_v_hs != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":441 + /* "gensim/models/word2vec_inner.pyx":442 * * if hs: * syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< * * if negative: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_syn1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_syn1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 441, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 442, __pyx_L1_error) __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":440 + /* "gensim/models/word2vec_inner.pyx":441 * cdef unsigned long long next_random * * if hs: # <<<<<<<<<<<<<< @@ -5620,7 +5733,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":443 + /* "gensim/models/word2vec_inner.pyx":444 * syn1 = (np.PyArray_DATA(model.trainables.syn1)) * * if negative: # <<<<<<<<<<<<<< @@ -5630,55 +5743,55 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_v_negative != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":444 + /* "gensim/models/word2vec_inner.pyx":445 * * if negative: * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) # <<<<<<<<<<<<<< * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) * cum_table_len = len(model.vocabulary.cum_table) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1neg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1neg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 444, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 445, __pyx_L1_error) __pyx_v_syn1neg = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":445 + /* "gensim/models/word2vec_inner.pyx":446 * if negative: * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) # <<<<<<<<<<<<<< * cum_table_len = len(model.vocabulary.cum_table) * if negative or sample: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 445, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 446, __pyx_L1_error) __pyx_v_cum_table = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":446 + /* "gensim/models/word2vec_inner.pyx":447 * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) * cum_table_len = len(model.vocabulary.cum_table) # <<<<<<<<<<<<<< * if negative or sample: * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_cum_table_len = __pyx_t_6; - /* "gensim/models/word2vec_inner.pyx":443 + /* "gensim/models/word2vec_inner.pyx":444 * syn1 = (np.PyArray_DATA(model.trainables.syn1)) * * if negative: # <<<<<<<<<<<<<< @@ -5687,7 +5800,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":447 + /* "gensim/models/word2vec_inner.pyx":448 * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) * cum_table_len = len(model.vocabulary.cum_table) * if negative or sample: # <<<<<<<<<<<<<< @@ -5705,41 +5818,41 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_L6_bool_binop_done:; if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":448 + /* "gensim/models/word2vec_inner.pyx":449 * cum_table_len = len(model.vocabulary.cum_table) * if negative or sample: * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_16777216, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_int_16777216, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_8); if (unlikely((__pyx_t_9 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_8); if (unlikely((__pyx_t_9 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_next_random = __pyx_t_9; - /* "gensim/models/word2vec_inner.pyx":447 + /* "gensim/models/word2vec_inner.pyx":448 * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) * cum_table_len = len(model.vocabulary.cum_table) * if negative or sample: # <<<<<<<<<<<<<< @@ -5748,42 +5861,42 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":451 + /* "gensim/models/word2vec_inner.pyx":452 * * # convert Python structures to primitive types, so we can release the GIL * work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< * neu1 = np.PyArray_DATA(_neu1) * */ - if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 451, __pyx_L1_error) + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 452, __pyx_L1_error) __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); - /* "gensim/models/word2vec_inner.pyx":452 + /* "gensim/models/word2vec_inner.pyx":453 * # convert Python structures to primitive types, so we can release the GIL * work = np.PyArray_DATA(_work) * neu1 = np.PyArray_DATA(_neu1) # <<<<<<<<<<<<<< * * # prepare C structures so we can go "full C" and release the Python GIL */ - if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 452, __pyx_L1_error) + if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 453, __pyx_L1_error) __pyx_v_neu1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__neu1))); - /* "gensim/models/word2vec_inner.pyx":455 + /* "gensim/models/word2vec_inner.pyx":456 * * # prepare C structures so we can go "full C" and release the Python GIL * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 455, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_vocab); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_vocab); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_vlookup = __pyx_t_3; __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":456 + /* "gensim/models/word2vec_inner.pyx":457 * # prepare C structures so we can go "full C" and release the Python GIL * vlookup = model.wv.vocab * sentence_idx[0] = 0 # indices of the first sentence always start at 0 # <<<<<<<<<<<<<< @@ -5792,7 +5905,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ (__pyx_v_sentence_idx[0]) = 0; - /* "gensim/models/word2vec_inner.pyx":457 + /* "gensim/models/word2vec_inner.pyx":458 * vlookup = model.wv.vocab * sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: # <<<<<<<<<<<<<< @@ -5803,26 +5916,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_3 = __pyx_v_sentences; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_sentences); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_sentences); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 458, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_10)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } @@ -5832,7 +5945,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 457, __pyx_L1_error) + else __PYX_ERR(0, 458, __pyx_L1_error) } break; } @@ -5841,18 +5954,18 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_sent, __pyx_t_8); __pyx_t_8 = 0; - /* "gensim/models/word2vec_inner.pyx":458 + /* "gensim/models/word2vec_inner.pyx":459 * sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: * if not sent: # <<<<<<<<<<<<<< * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_sent); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_sent); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 459, __pyx_L1_error) __pyx_t_7 = ((!__pyx_t_4) != 0); if (__pyx_t_7) { - /* "gensim/models/word2vec_inner.pyx":459 + /* "gensim/models/word2vec_inner.pyx":460 * for sent in sentences: * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged # <<<<<<<<<<<<<< @@ -5861,7 +5974,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L8_continue; - /* "gensim/models/word2vec_inner.pyx":458 + /* "gensim/models/word2vec_inner.pyx":459 * sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: * if not sent: # <<<<<<<<<<<<<< @@ -5870,7 +5983,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":460 + /* "gensim/models/word2vec_inner.pyx":461 * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: # <<<<<<<<<<<<<< @@ -5881,26 +5994,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_8 = __pyx_v_sent; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_sent); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_sent); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 461, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_12)) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -5910,7 +6023,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 460, __pyx_L1_error) + else __PYX_ERR(0, 461, __pyx_L1_error) } break; } @@ -5919,16 +6032,16 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":461 + /* "gensim/models/word2vec_inner.pyx":462 * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window */ - __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 462, __pyx_L1_error) if ((__pyx_t_7 != 0)) { - __pyx_t_13 = PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 461, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_1 = __pyx_t_13; __pyx_t_13 = 0; @@ -5939,7 +6052,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":462 + /* "gensim/models/word2vec_inner.pyx":463 * for token in sent: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -5950,7 +6063,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":463 + /* "gensim/models/word2vec_inner.pyx":464 * word = vlookup[token] if token in vlookup else None * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window # <<<<<<<<<<<<<< @@ -5959,7 +6072,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L11_continue; - /* "gensim/models/word2vec_inner.pyx":462 + /* "gensim/models/word2vec_inner.pyx":463 * for token in sent: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -5968,7 +6081,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":464 + /* "gensim/models/word2vec_inner.pyx":465 * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if sample and word.sample_int < random_int32(&next_random): # <<<<<<<<<<<<<< @@ -5981,20 +6094,20 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = __pyx_t_7; goto __pyx_L15_bool_binop_done; } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_sample_int); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_sample_int); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_6gensim_6models_14word2vec_inner_random_int32((&__pyx_v_next_random))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_6gensim_6models_14word2vec_inner_random_int32((&__pyx_v_next_random))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_14 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 464, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_4 = __pyx_t_7; __pyx_L15_bool_binop_done:; if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":465 + /* "gensim/models/word2vec_inner.pyx":466 * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if sample and word.sample_int < random_int32(&next_random): * continue # <<<<<<<<<<<<<< @@ -6003,7 +6116,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L11_continue; - /* "gensim/models/word2vec_inner.pyx":464 + /* "gensim/models/word2vec_inner.pyx":465 * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if sample and word.sample_int < random_int32(&next_random): # <<<<<<<<<<<<<< @@ -6012,20 +6125,20 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":466 + /* "gensim/models/word2vec_inner.pyx":467 * if sample and word.sample_int < random_int32(&next_random): * continue * indexes[effective_words] = word.index # <<<<<<<<<<<<<< * if hs: * codelens[effective_words] = len(word.code) */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; (__pyx_v_indexes[__pyx_v_effective_words]) = __pyx_t_15; - /* "gensim/models/word2vec_inner.pyx":467 + /* "gensim/models/word2vec_inner.pyx":468 * continue * indexes[effective_words] = word.index * if hs: # <<<<<<<<<<<<<< @@ -6035,46 +6148,46 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_v_hs != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":468 + /* "gensim/models/word2vec_inner.pyx":469 * indexes[effective_words] = word.index * if hs: * codelens[effective_words] = len(word.code) # <<<<<<<<<<<<<< * codes[effective_words] = np.PyArray_DATA(word.code) * points[effective_words] = np.PyArray_DATA(word.point) */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 468, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_16 = PyObject_Length(__pyx_t_14); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 468, __pyx_L1_error) + __pyx_t_16 = PyObject_Length(__pyx_t_14); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; (__pyx_v_codelens[__pyx_v_effective_words]) = ((int)__pyx_t_16); - /* "gensim/models/word2vec_inner.pyx":469 + /* "gensim/models/word2vec_inner.pyx":470 * if hs: * codelens[effective_words] = len(word.code) * codes[effective_words] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< * points[effective_words] = np.PyArray_DATA(word.point) * effective_words += 1 */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 469, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 469, __pyx_L1_error) + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 470, __pyx_L1_error) (__pyx_v_codes[__pyx_v_effective_words]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_14))); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "gensim/models/word2vec_inner.pyx":470 + /* "gensim/models/word2vec_inner.pyx":471 * codelens[effective_words] = len(word.code) * codes[effective_words] = np.PyArray_DATA(word.code) * points[effective_words] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 470, __pyx_L1_error) + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 471, __pyx_L1_error) (__pyx_v_points[__pyx_v_effective_words]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_14))); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "gensim/models/word2vec_inner.pyx":467 + /* "gensim/models/word2vec_inner.pyx":468 * continue * indexes[effective_words] = word.index * if hs: # <<<<<<<<<<<<<< @@ -6083,7 +6196,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":471 + /* "gensim/models/word2vec_inner.pyx":472 * codes[effective_words] = np.PyArray_DATA(word.code) * points[effective_words] = np.PyArray_DATA(word.point) * effective_words += 1 # <<<<<<<<<<<<<< @@ -6092,7 +6205,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_effective_words = (__pyx_v_effective_words + 1); - /* "gensim/models/word2vec_inner.pyx":472 + /* "gensim/models/word2vec_inner.pyx":473 * points[effective_words] = np.PyArray_DATA(word.point) * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -6102,7 +6215,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = ((__pyx_v_effective_words == 0x2710) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":473 + /* "gensim/models/word2vec_inner.pyx":474 * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -6111,7 +6224,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L12_break; - /* "gensim/models/word2vec_inner.pyx":472 + /* "gensim/models/word2vec_inner.pyx":473 * points[effective_words] = np.PyArray_DATA(word.point) * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -6120,7 +6233,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":460 + /* "gensim/models/word2vec_inner.pyx":461 * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: # <<<<<<<<<<<<<< @@ -6132,7 +6245,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_L12_break:; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "gensim/models/word2vec_inner.pyx":478 + /* "gensim/models/word2vec_inner.pyx":479 * # across sentence boundaries. * # indices of sentence number X are between tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { @@ -6273,17 +6386,17 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT if (likely(PyList_CheckExact(__pyx_t_14))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_14)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_14)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -6293,7 +6406,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 485, __pyx_L1_error) + else __PYX_ERR(0, 486, __pyx_L1_error) } break; } @@ -6304,17 +6417,17 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_v_i = __pyx_t_2; __pyx_t_2 = (__pyx_t_2 + 1); - /* "gensim/models/word2vec_inner.pyx":486 + /* "gensim/models/word2vec_inner.pyx":487 * # precompute "reduced window" offsets in a single randint() call * for i, item in enumerate(model.random.randint(0, window, effective_words)): * reduced_windows[i] = item # <<<<<<<<<<<<<< * * # release GIL & train on all sentences */ - __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_v_item); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 486, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_v_item); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error) (__pyx_v_reduced_windows[__pyx_v_i]) = __pyx_t_15; - /* "gensim/models/word2vec_inner.pyx":485 + /* "gensim/models/word2vec_inner.pyx":486 * * # precompute "reduced window" offsets in a single randint() call * for i, item in enumerate(model.random.randint(0, window, effective_words)): # <<<<<<<<<<<<<< @@ -6324,7 +6437,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "gensim/models/word2vec_inner.pyx":489 + /* "gensim/models/word2vec_inner.pyx":490 * * # release GIL & train on all sentences * with nogil: # <<<<<<<<<<<<<< @@ -6339,7 +6452,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT #endif /*try:*/ { - /* "gensim/models/word2vec_inner.pyx":490 + /* "gensim/models/word2vec_inner.pyx":491 * # release GIL & train on all sentences * with nogil: * for sent_idx in range(effective_sentences): # <<<<<<<<<<<<<< @@ -6347,10 +6460,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT * idx_end = sentence_idx[sent_idx + 1] */ __pyx_t_2 = __pyx_v_effective_sentences; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_2; __pyx_t_17+=1) { - __pyx_v_sent_idx = __pyx_t_17; + __pyx_t_17 = __pyx_t_2; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) { + __pyx_v_sent_idx = __pyx_t_19; - /* "gensim/models/word2vec_inner.pyx":491 + /* "gensim/models/word2vec_inner.pyx":492 * with nogil: * for sent_idx in range(effective_sentences): * idx_start = sentence_idx[sent_idx] # <<<<<<<<<<<<<< @@ -6359,7 +6473,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_idx_start = (__pyx_v_sentence_idx[__pyx_v_sent_idx]); - /* "gensim/models/word2vec_inner.pyx":492 + /* "gensim/models/word2vec_inner.pyx":493 * for sent_idx in range(effective_sentences): * idx_start = sentence_idx[sent_idx] * idx_end = sentence_idx[sent_idx + 1] # <<<<<<<<<<<<<< @@ -6368,18 +6482,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_idx_end = (__pyx_v_sentence_idx[(__pyx_v_sent_idx + 1)]); - /* "gensim/models/word2vec_inner.pyx":493 + /* "gensim/models/word2vec_inner.pyx":494 * idx_start = sentence_idx[sent_idx] * idx_end = sentence_idx[sent_idx + 1] * for i in range(idx_start, idx_end): # <<<<<<<<<<<<<< * j = i - window + reduced_windows[i] * if j < idx_start: */ - __pyx_t_19 = __pyx_v_idx_end; - for (__pyx_t_20 = __pyx_v_idx_start; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { - __pyx_v_i = __pyx_t_20; + __pyx_t_20 = __pyx_v_idx_end; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = __pyx_v_idx_start; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_i = __pyx_t_22; - /* "gensim/models/word2vec_inner.pyx":494 + /* "gensim/models/word2vec_inner.pyx":495 * idx_end = sentence_idx[sent_idx + 1] * for i in range(idx_start, idx_end): * j = i - window + reduced_windows[i] # <<<<<<<<<<<<<< @@ -6388,7 +6503,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_j = ((__pyx_v_i - __pyx_v_window) + (__pyx_v_reduced_windows[__pyx_v_i])); - /* "gensim/models/word2vec_inner.pyx":495 + /* "gensim/models/word2vec_inner.pyx":496 * for i in range(idx_start, idx_end): * j = i - window + reduced_windows[i] * if j < idx_start: # <<<<<<<<<<<<<< @@ -6398,7 +6513,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = ((__pyx_v_j < __pyx_v_idx_start) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":496 + /* "gensim/models/word2vec_inner.pyx":497 * j = i - window + reduced_windows[i] * if j < idx_start: * j = idx_start # <<<<<<<<<<<<<< @@ -6407,7 +6522,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_j = __pyx_v_idx_start; - /* "gensim/models/word2vec_inner.pyx":495 + /* "gensim/models/word2vec_inner.pyx":496 * for i in range(idx_start, idx_end): * j = i - window + reduced_windows[i] * if j < idx_start: # <<<<<<<<<<<<<< @@ -6416,7 +6531,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":497 + /* "gensim/models/word2vec_inner.pyx":498 * if j < idx_start: * j = idx_start * k = i + window + 1 - reduced_windows[i] # <<<<<<<<<<<<<< @@ -6425,7 +6540,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_k = (((__pyx_v_i + __pyx_v_window) + 1) - (__pyx_v_reduced_windows[__pyx_v_i])); - /* "gensim/models/word2vec_inner.pyx":498 + /* "gensim/models/word2vec_inner.pyx":499 * j = idx_start * k = i + window + 1 - reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< @@ -6435,7 +6550,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = ((__pyx_v_k > __pyx_v_idx_end) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":499 + /* "gensim/models/word2vec_inner.pyx":500 * k = i + window + 1 - reduced_windows[i] * if k > idx_end: * k = idx_end # <<<<<<<<<<<<<< @@ -6444,7 +6559,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_k = __pyx_v_idx_end; - /* "gensim/models/word2vec_inner.pyx":498 + /* "gensim/models/word2vec_inner.pyx":499 * j = idx_start * k = i + window + 1 - reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< @@ -6453,7 +6568,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":500 + /* "gensim/models/word2vec_inner.pyx":501 * if k > idx_end: * k = idx_end * if hs: # <<<<<<<<<<<<<< @@ -6463,7 +6578,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_v_hs != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":501 + /* "gensim/models/word2vec_inner.pyx":502 * k = idx_end * if hs: * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< @@ -6472,7 +6587,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_hs((__pyx_v_points[__pyx_v_i]), (__pyx_v_codes[__pyx_v_i]), __pyx_v_codelens, __pyx_v_neu1, __pyx_v_syn0, __pyx_v_syn1, __pyx_v_size, __pyx_v_indexes, __pyx_v__alpha, __pyx_v_work, __pyx_v_i, __pyx_v_j, __pyx_v_k, __pyx_v_cbow_mean, __pyx_v_word_locks, __pyx_v__compute_loss, (&__pyx_v__running_training_loss)); - /* "gensim/models/word2vec_inner.pyx":500 + /* "gensim/models/word2vec_inner.pyx":501 * if k > idx_end: * k = idx_end * if hs: # <<<<<<<<<<<<<< @@ -6481,7 +6596,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } - /* "gensim/models/word2vec_inner.pyx":502 + /* "gensim/models/word2vec_inner.pyx":503 * if hs: * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) * if negative: # <<<<<<<<<<<<<< @@ -6491,16 +6606,16 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_4 = (__pyx_v_negative != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":503 + /* "gensim/models/word2vec_inner.pyx":504 * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) * if negative: * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< * - * model.running_training_loss = _running_training_loss + * model.running_training_loss += _running_training_loss */ __pyx_v_next_random = __pyx_f_6gensim_6models_14word2vec_inner_fast_sentence_cbow_neg(__pyx_v_negative, __pyx_v_cum_table, __pyx_v_cum_table_len, __pyx_v_codelens, __pyx_v_neu1, __pyx_v_syn0, __pyx_v_syn1neg, __pyx_v_size, __pyx_v_indexes, __pyx_v__alpha, __pyx_v_work, __pyx_v_i, __pyx_v_j, __pyx_v_k, __pyx_v_cbow_mean, __pyx_v_next_random, __pyx_v_word_locks, __pyx_v__compute_loss, (&__pyx_v__running_training_loss)); - /* "gensim/models/word2vec_inner.pyx":502 + /* "gensim/models/word2vec_inner.pyx":503 * if hs: * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) * if negative: # <<<<<<<<<<<<<< @@ -6512,7 +6627,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } } - /* "gensim/models/word2vec_inner.pyx":489 + /* "gensim/models/word2vec_inner.pyx":490 * * # release GIL & train on all sentences * with nogil: # <<<<<<<<<<<<<< @@ -6531,33 +6646,49 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } } - /* "gensim/models/word2vec_inner.pyx":505 + /* "gensim/models/word2vec_inner.pyx":506 * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) * - * model.running_training_loss = _running_training_loss # <<<<<<<<<<<<<< - * return effective_words + * model.running_training_loss += _running_training_loss # <<<<<<<<<<<<<< + * return effective_words, effective_words * */ - __pyx_t_14 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_14) < 0) __PYX_ERR(0, 505, __pyx_L1_error) + __pyx_t_3 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_18) < 0) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; - /* "gensim/models/word2vec_inner.pyx":506 + /* "gensim/models/word2vec_inner.pyx":507 * - * model.running_training_loss = _running_training_loss - * return effective_words # <<<<<<<<<<<<<< + * model.running_training_loss += _running_training_loss + * return effective_words, effective_words # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 506, __pyx_L1_error) + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __pyx_t_18 = 0; + __pyx_t_3 = 0; __pyx_r = __pyx_t_14; __pyx_t_14 = 0; goto __pyx_L0; - /* "gensim/models/word2vec_inner.pyx":403 + /* "gensim/models/word2vec_inner.pyx":404 * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< @@ -6586,7 +6717,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT return __pyx_r; } -/* "gensim/models/word2vec_inner.pyx":510 +/* "gensim/models/word2vec_inner.pyx":511 * * # Score is only implemented for hierarchical softmax * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< @@ -6623,23 +6754,23 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_5score_sentence_sg(Py kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 1); __PYX_ERR(0, 510, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 1); __PYX_ERR(0, 511, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 2); __PYX_ERR(0, 510, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 2); __PYX_ERR(0, 511, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_sg") < 0)) __PYX_ERR(0, 510, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_sg") < 0)) __PYX_ERR(0, 511, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6654,7 +6785,7 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_5score_sentence_sg(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 510, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 511, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.score_sentence_sg", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6700,54 +6831,56 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY int __pyx_t_11; int __pyx_t_12; int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; __Pyx_RefNannySetupContext("score_sentence_sg", 0); - /* "gensim/models/word2vec_inner.pyx":512 + /* "gensim/models/word2vec_inner.pyx":513 * def score_sentence_sg(model, sentence, _work): * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * cdef REAL_t *work * cdef int size = model.wv.vector_size */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 512, __pyx_L1_error) + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 513, __pyx_L1_error) __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":514 + /* "gensim/models/word2vec_inner.pyx":515 * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) * cdef REAL_t *work * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< * * cdef int codelens[MAX_SENTENCE_LEN] */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 514, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 515, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_3; - /* "gensim/models/word2vec_inner.pyx":519 + /* "gensim/models/word2vec_inner.pyx":520 * cdef np.uint32_t indexes[MAX_SENTENCE_LEN] * cdef int sentence_len * cdef int window = model.window # <<<<<<<<<<<<<< * * cdef int i, j, k */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 519, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_window = __pyx_t_3; - /* "gensim/models/word2vec_inner.pyx":522 + /* "gensim/models/word2vec_inner.pyx":523 * * cdef int i, j, k * cdef long result = 0 # <<<<<<<<<<<<<< @@ -6756,48 +6889,48 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_result = 0; - /* "gensim/models/word2vec_inner.pyx":528 + /* "gensim/models/word2vec_inner.pyx":529 * cdef np.uint8_t *codes[MAX_SENTENCE_LEN] * * syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 528, __pyx_L1_error) + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 529, __pyx_L1_error) __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":531 + /* "gensim/models/word2vec_inner.pyx":532 * * # convert Python structures to primitive types, so we can release the GIL * work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< * * vlookup = model.wv.vocab */ - if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 531, __pyx_L1_error) + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 532, __pyx_L1_error) __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); - /* "gensim/models/word2vec_inner.pyx":533 + /* "gensim/models/word2vec_inner.pyx":534 * work = np.PyArray_DATA(_work) * * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * i = 0 * for token in sentence: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_vlookup = __pyx_t_1; __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":534 + /* "gensim/models/word2vec_inner.pyx":535 * * vlookup = model.wv.vocab * i = 0 # <<<<<<<<<<<<<< @@ -6806,7 +6939,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_i = 0; - /* "gensim/models/word2vec_inner.pyx":535 + /* "gensim/models/word2vec_inner.pyx":536 * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -6817,26 +6950,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_1 = __pyx_v_sentence; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -6846,7 +6979,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 535, __pyx_L1_error) + else __PYX_ERR(0, 536, __pyx_L1_error) } break; } @@ -6855,16 +6988,16 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":536 + /* "gensim/models/word2vec_inner.pyx":537 * i = 0 * for token in sentence: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # should drop the */ - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 537, __pyx_L1_error) if ((__pyx_t_6 != 0)) { - __pyx_t_7 = PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 536, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; @@ -6875,7 +7008,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":537 + /* "gensim/models/word2vec_inner.pyx":538 * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -6886,7 +7019,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = (__pyx_t_6 != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":538 + /* "gensim/models/word2vec_inner.pyx":539 * word = vlookup[token] if token in vlookup else None * if word is None: * continue # should drop the # <<<<<<<<<<<<<< @@ -6895,7 +7028,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L3_continue; - /* "gensim/models/word2vec_inner.pyx":537 + /* "gensim/models/word2vec_inner.pyx":538 * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -6904,59 +7037,59 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":539 + /* "gensim/models/word2vec_inner.pyx":540 * if word is None: * continue # should drop the * indexes[i] = word.index # <<<<<<<<<<<<<< * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_indexes[__pyx_v_i]) = __pyx_t_9; - /* "gensim/models/word2vec_inner.pyx":540 + /* "gensim/models/word2vec_inner.pyx":541 * continue # should drop the * indexes[i] = word.index * codelens[i] = len(word.code) # <<<<<<<<<<<<<< * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_codelens[__pyx_v_i]) = ((int)__pyx_t_10); - /* "gensim/models/word2vec_inner.pyx":541 + /* "gensim/models/word2vec_inner.pyx":542 * indexes[i] = word.index * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< * points[i] = np.PyArray_DATA(word.point) * result += 1 */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 541, __pyx_L1_error) + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 542, __pyx_L1_error) (__pyx_v_codes[__pyx_v_i]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":542 + /* "gensim/models/word2vec_inner.pyx":543 * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< * result += 1 * i += 1 */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 542, __pyx_L1_error) + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 543, __pyx_L1_error) (__pyx_v_points[__pyx_v_i]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "gensim/models/word2vec_inner.pyx":543 + /* "gensim/models/word2vec_inner.pyx":544 * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) * result += 1 # <<<<<<<<<<<<<< @@ -6965,7 +7098,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_result = (__pyx_v_result + 1); - /* "gensim/models/word2vec_inner.pyx":544 + /* "gensim/models/word2vec_inner.pyx":545 * points[i] = np.PyArray_DATA(word.point) * result += 1 * i += 1 # <<<<<<<<<<<<<< @@ -6974,7 +7107,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_i = (__pyx_v_i + 1); - /* "gensim/models/word2vec_inner.pyx":545 + /* "gensim/models/word2vec_inner.pyx":546 * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -6984,7 +7117,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_i == 0x2710) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":546 + /* "gensim/models/word2vec_inner.pyx":547 * i += 1 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -6993,7 +7126,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L4_break; - /* "gensim/models/word2vec_inner.pyx":545 + /* "gensim/models/word2vec_inner.pyx":546 * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -7002,7 +7135,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":535 + /* "gensim/models/word2vec_inner.pyx":536 * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -7014,7 +7147,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_L4_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":547 + /* "gensim/models/word2vec_inner.pyx":548 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? * sentence_len = i # <<<<<<<<<<<<<< @@ -7023,7 +7156,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_sentence_len = __pyx_v_i; - /* "gensim/models/word2vec_inner.pyx":550 + /* "gensim/models/word2vec_inner.pyx":551 * * # release GIL & train on the sentence * work[0] = 0.0 # <<<<<<<<<<<<<< @@ -7032,7 +7165,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ (__pyx_v_work[0]) = 0.0; - /* "gensim/models/word2vec_inner.pyx":552 + /* "gensim/models/word2vec_inner.pyx":553 * work[0] = 0.0 * * with nogil: # <<<<<<<<<<<<<< @@ -7047,7 +7180,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY #endif /*try:*/ { - /* "gensim/models/word2vec_inner.pyx":553 + /* "gensim/models/word2vec_inner.pyx":554 * * with nogil: * for i in range(sentence_len): # <<<<<<<<<<<<<< @@ -7055,10 +7188,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY * continue */ __pyx_t_3 = __pyx_v_sentence_len; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_3; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_11 = __pyx_t_3; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "gensim/models/word2vec_inner.pyx":554 + /* "gensim/models/word2vec_inner.pyx":555 * with nogil: * for i in range(sentence_len): * if codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7068,7 +7202,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = (((__pyx_v_codelens[__pyx_v_i]) == 0) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":555 + /* "gensim/models/word2vec_inner.pyx":556 * for i in range(sentence_len): * if codelens[i] == 0: * continue # <<<<<<<<<<<<<< @@ -7077,7 +7211,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L10_continue; - /* "gensim/models/word2vec_inner.pyx":554 + /* "gensim/models/word2vec_inner.pyx":555 * with nogil: * for i in range(sentence_len): * if codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7086,7 +7220,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":556 + /* "gensim/models/word2vec_inner.pyx":557 * if codelens[i] == 0: * continue * j = i - window # <<<<<<<<<<<<<< @@ -7095,7 +7229,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_j = (__pyx_v_i - __pyx_v_window); - /* "gensim/models/word2vec_inner.pyx":557 + /* "gensim/models/word2vec_inner.pyx":558 * continue * j = i - window * if j < 0: # <<<<<<<<<<<<<< @@ -7105,7 +7239,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_j < 0) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":558 + /* "gensim/models/word2vec_inner.pyx":559 * j = i - window * if j < 0: * j = 0 # <<<<<<<<<<<<<< @@ -7114,7 +7248,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_j = 0; - /* "gensim/models/word2vec_inner.pyx":557 + /* "gensim/models/word2vec_inner.pyx":558 * continue * j = i - window * if j < 0: # <<<<<<<<<<<<<< @@ -7123,7 +7257,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":559 + /* "gensim/models/word2vec_inner.pyx":560 * if j < 0: * j = 0 * k = i + window + 1 # <<<<<<<<<<<<<< @@ -7132,7 +7266,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_k = ((__pyx_v_i + __pyx_v_window) + 1); - /* "gensim/models/word2vec_inner.pyx":560 + /* "gensim/models/word2vec_inner.pyx":561 * j = 0 * k = i + window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7142,7 +7276,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_k > __pyx_v_sentence_len) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":561 + /* "gensim/models/word2vec_inner.pyx":562 * k = i + window + 1 * if k > sentence_len: * k = sentence_len # <<<<<<<<<<<<<< @@ -7151,7 +7285,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_k = __pyx_v_sentence_len; - /* "gensim/models/word2vec_inner.pyx":560 + /* "gensim/models/word2vec_inner.pyx":561 * j = 0 * k = i + window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7160,18 +7294,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":562 + /* "gensim/models/word2vec_inner.pyx":563 * if k > sentence_len: * k = sentence_len * for j in range(j, k): # <<<<<<<<<<<<<< * if j == i or codelens[j] == 0: * continue */ - __pyx_t_12 = __pyx_v_k; - for (__pyx_t_13 = __pyx_v_j; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_j = __pyx_t_13; + __pyx_t_13 = __pyx_v_k; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = __pyx_v_j; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "gensim/models/word2vec_inner.pyx":563 + /* "gensim/models/word2vec_inner.pyx":564 * k = sentence_len * for j in range(j, k): * if j == i or codelens[j] == 0: # <<<<<<<<<<<<<< @@ -7189,7 +7324,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_L18_bool_binop_done:; if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":564 + /* "gensim/models/word2vec_inner.pyx":565 * for j in range(j, k): * if j == i or codelens[j] == 0: * continue # <<<<<<<<<<<<<< @@ -7198,7 +7333,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L15_continue; - /* "gensim/models/word2vec_inner.pyx":563 + /* "gensim/models/word2vec_inner.pyx":564 * k = sentence_len * for j in range(j, k): * if j == i or codelens[j] == 0: # <<<<<<<<<<<<<< @@ -7207,7 +7342,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } - /* "gensim/models/word2vec_inner.pyx":565 + /* "gensim/models/word2vec_inner.pyx":566 * if j == i or codelens[j] == 0: * continue * score_pair_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], work) # <<<<<<<<<<<<<< @@ -7221,7 +7356,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY } } - /* "gensim/models/word2vec_inner.pyx":552 + /* "gensim/models/word2vec_inner.pyx":553 * work[0] = 0.0 * * with nogil: # <<<<<<<<<<<<<< @@ -7240,7 +7375,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY } } - /* "gensim/models/word2vec_inner.pyx":567 + /* "gensim/models/word2vec_inner.pyx":568 * score_pair_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], work) * * return work[0] # <<<<<<<<<<<<<< @@ -7248,13 +7383,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY * cdef void score_pair_sg_hs( */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 567, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "gensim/models/word2vec_inner.pyx":510 + /* "gensim/models/word2vec_inner.pyx":511 * * # Score is only implemented for hierarchical softmax * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< @@ -7278,7 +7413,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY return __pyx_r; } -/* "gensim/models/word2vec_inner.pyx":569 +/* "gensim/models/word2vec_inner.pyx":570 * return work[0] * * cdef void score_pair_sg_hs( # <<<<<<<<<<<<<< @@ -7293,12 +7428,13 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n PY_LONG_LONG __pyx_v_sgn; __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_v_f; int __pyx_t_1; - PY_LONG_LONG __pyx_t_2; - int __pyx_t_3; + int __pyx_t_2; + PY_LONG_LONG __pyx_t_3; int __pyx_t_4; - long __pyx_t_5; + int __pyx_t_5; + long __pyx_t_6; - /* "gensim/models/word2vec_inner.pyx":575 + /* "gensim/models/word2vec_inner.pyx":576 * * cdef long long b * cdef long long row1 = word2_index * size, row2, sgn # <<<<<<<<<<<<<< @@ -7307,7 +7443,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_row1 = (__pyx_v_word2_index * __pyx_v_size); - /* "gensim/models/word2vec_inner.pyx":578 + /* "gensim/models/word2vec_inner.pyx":579 * cdef REAL_t f * * for b in range(codelen): # <<<<<<<<<<<<<< @@ -7315,10 +7451,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) */ __pyx_t_1 = __pyx_v_codelen; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_b = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_b = __pyx_t_3; - /* "gensim/models/word2vec_inner.pyx":579 + /* "gensim/models/word2vec_inner.pyx":580 * * for b in range(codelen): * row2 = word_point[b] * size # <<<<<<<<<<<<<< @@ -7327,7 +7464,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_row2 = ((__pyx_v_word_point[__pyx_v_b]) * __pyx_v_size); - /* "gensim/models/word2vec_inner.pyx":580 + /* "gensim/models/word2vec_inner.pyx":581 * for b in range(codelen): * row2 = word_point[b] * size * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) # <<<<<<<<<<<<<< @@ -7336,7 +7473,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = __pyx_v_6gensim_6models_14word2vec_inner_our_dot((&__pyx_v_size), (&(__pyx_v_syn0[__pyx_v_row1])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), (&(__pyx_v_syn1[__pyx_v_row2])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); - /* "gensim/models/word2vec_inner.pyx":581 + /* "gensim/models/word2vec_inner.pyx":582 * row2 = word_point[b] * size * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 # <<<<<<<<<<<<<< @@ -7345,7 +7482,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_sgn = __Pyx_pow_long(-1L, ((long)(__pyx_v_word_code[__pyx_v_b]))); - /* "gensim/models/word2vec_inner.pyx":582 + /* "gensim/models/word2vec_inner.pyx":583 * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn # <<<<<<<<<<<<<< @@ -7354,25 +7491,25 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = (__pyx_v_f * __pyx_v_sgn); - /* "gensim/models/word2vec_inner.pyx":583 + /* "gensim/models/word2vec_inner.pyx":584 * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_f <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_f <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L6_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_f >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_f >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L6_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":584 + /* "gensim/models/word2vec_inner.pyx":585 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: * continue # <<<<<<<<<<<<<< @@ -7381,7 +7518,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ goto __pyx_L3_continue; - /* "gensim/models/word2vec_inner.pyx":583 + /* "gensim/models/word2vec_inner.pyx":584 * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -7390,7 +7527,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ } - /* "gensim/models/word2vec_inner.pyx":585 + /* "gensim/models/word2vec_inner.pyx":586 * if f <= -MAX_EXP or f >= MAX_EXP: * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] # <<<<<<<<<<<<<< @@ -7399,19 +7536,19 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[((int)((__pyx_v_f + 6.0) * 83.0))]); - /* "gensim/models/word2vec_inner.pyx":586 + /* "gensim/models/word2vec_inner.pyx":587 * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] * work[0] += f # <<<<<<<<<<<<<< * * def score_sentence_cbow(model, sentence, _work, _neu1): */ - __pyx_t_5 = 0; - (__pyx_v_work[__pyx_t_5]) = ((__pyx_v_work[__pyx_t_5]) + __pyx_v_f); + __pyx_t_6 = 0; + (__pyx_v_work[__pyx_t_6]) = ((__pyx_v_work[__pyx_t_6]) + __pyx_v_f); __pyx_L3_continue:; } - /* "gensim/models/word2vec_inner.pyx":569 + /* "gensim/models/word2vec_inner.pyx":570 * return work[0] * * cdef void score_pair_sg_hs( # <<<<<<<<<<<<<< @@ -7422,7 +7559,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n /* function exit code */ } -/* "gensim/models/word2vec_inner.pyx":588 +/* "gensim/models/word2vec_inner.pyx":589 * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< @@ -7462,29 +7599,29 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_7score_sentence_cbow( kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 1); __PYX_ERR(0, 588, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 1); __PYX_ERR(0, 589, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 2); __PYX_ERR(0, 588, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 2); __PYX_ERR(0, 589, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 3); __PYX_ERR(0, 588, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 3); __PYX_ERR(0, 589, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_cbow") < 0)) __PYX_ERR(0, 588, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_cbow") < 0)) __PYX_ERR(0, 589, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -7501,7 +7638,7 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_7score_sentence_cbow( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 588, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 589, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.score_sentence_cbow", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7547,67 +7684,68 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_5numpy_uint32_t __pyx_t_9; Py_ssize_t __pyx_t_10; int __pyx_t_11; + int __pyx_t_12; __Pyx_RefNannySetupContext("score_sentence_cbow", 0); - /* "gensim/models/word2vec_inner.pyx":590 + /* "gensim/models/word2vec_inner.pyx":591 * def score_sentence_cbow(model, sentence, _work, _neu1): * * cdef int cbow_mean = model.cbow_mean # <<<<<<<<<<<<<< * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 590, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cbow_mean = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":592 + /* "gensim/models/word2vec_inner.pyx":593 * cdef int cbow_mean = model.cbow_mean * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * cdef REAL_t *work * cdef REAL_t *neu1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 592, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 593, __pyx_L1_error) __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":595 + /* "gensim/models/word2vec_inner.pyx":596 * cdef REAL_t *work * cdef REAL_t *neu1 * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< * * cdef int codelens[MAX_SENTENCE_LEN] */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_size = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":600 + /* "gensim/models/word2vec_inner.pyx":601 * cdef np.uint32_t indexes[MAX_SENTENCE_LEN] * cdef int sentence_len * cdef int window = model.window # <<<<<<<<<<<<<< * * cdef int i, j, k */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 601, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_window = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":603 + /* "gensim/models/word2vec_inner.pyx":604 * * cdef int i, j, k * cdef long result = 0 # <<<<<<<<<<<<<< @@ -7616,58 +7754,58 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_result = 0; - /* "gensim/models/word2vec_inner.pyx":610 + /* "gensim/models/word2vec_inner.pyx":611 * cdef np.uint8_t *codes[MAX_SENTENCE_LEN] * * syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 610, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 611, __pyx_L1_error) __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":613 + /* "gensim/models/word2vec_inner.pyx":614 * * # convert Python structures to primitive types, so we can release the GIL * work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< * neu1 = np.PyArray_DATA(_neu1) * */ - if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 613, __pyx_L1_error) + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 614, __pyx_L1_error) __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); - /* "gensim/models/word2vec_inner.pyx":614 + /* "gensim/models/word2vec_inner.pyx":615 * # convert Python structures to primitive types, so we can release the GIL * work = np.PyArray_DATA(_work) * neu1 = np.PyArray_DATA(_neu1) # <<<<<<<<<<<<<< * * vlookup = model.wv.vocab */ - if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 614, __pyx_L1_error) + if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 615, __pyx_L1_error) __pyx_v_neu1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__neu1))); - /* "gensim/models/word2vec_inner.pyx":616 + /* "gensim/models/word2vec_inner.pyx":617 * neu1 = np.PyArray_DATA(_neu1) * * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * i = 0 * for token in sentence: */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 616, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_vlookup = __pyx_t_1; __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":617 + /* "gensim/models/word2vec_inner.pyx":618 * * vlookup = model.wv.vocab * i = 0 # <<<<<<<<<<<<<< @@ -7676,7 +7814,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_i = 0; - /* "gensim/models/word2vec_inner.pyx":618 + /* "gensim/models/word2vec_inner.pyx":619 * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -7687,26 +7825,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_1 = __pyx_v_sentence; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } @@ -7716,7 +7854,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 618, __pyx_L1_error) + else __PYX_ERR(0, 619, __pyx_L1_error) } break; } @@ -7725,16 +7863,16 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":619 + /* "gensim/models/word2vec_inner.pyx":620 * i = 0 * for token in sentence: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # for score, should this be a default negative value? */ - __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 620, __pyx_L1_error) if ((__pyx_t_6 != 0)) { - __pyx_t_7 = PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 619, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; @@ -7745,7 +7883,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":620 + /* "gensim/models/word2vec_inner.pyx":621 * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -7756,7 +7894,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = (__pyx_t_6 != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":621 + /* "gensim/models/word2vec_inner.pyx":622 * word = vlookup[token] if token in vlookup else None * if word is None: * continue # for score, should this be a default negative value? # <<<<<<<<<<<<<< @@ -7765,7 +7903,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L3_continue; - /* "gensim/models/word2vec_inner.pyx":620 + /* "gensim/models/word2vec_inner.pyx":621 * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -7774,59 +7912,59 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } - /* "gensim/models/word2vec_inner.pyx":622 + /* "gensim/models/word2vec_inner.pyx":623 * if word is None: * continue # for score, should this be a default negative value? * indexes[i] = word.index # <<<<<<<<<<<<<< * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_3); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 622, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_3); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_indexes[__pyx_v_i]) = __pyx_t_9; - /* "gensim/models/word2vec_inner.pyx":623 + /* "gensim/models/word2vec_inner.pyx":624 * continue # for score, should this be a default negative value? * indexes[i] = word.index * codelens[i] = len(word.code) # <<<<<<<<<<<<<< * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 623, __pyx_L1_error) + __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_codelens[__pyx_v_i]) = ((int)__pyx_t_10); - /* "gensim/models/word2vec_inner.pyx":624 + /* "gensim/models/word2vec_inner.pyx":625 * indexes[i] = word.index * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< * points[i] = np.PyArray_DATA(word.point) * result += 1 */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 624, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 625, __pyx_L1_error) (__pyx_v_codes[__pyx_v_i]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":625 + /* "gensim/models/word2vec_inner.pyx":626 * codelens[i] = len(word.code) * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< * result += 1 * i += 1 */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 625, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 626, __pyx_L1_error) (__pyx_v_points[__pyx_v_i]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "gensim/models/word2vec_inner.pyx":626 + /* "gensim/models/word2vec_inner.pyx":627 * codes[i] = np.PyArray_DATA(word.code) * points[i] = np.PyArray_DATA(word.point) * result += 1 # <<<<<<<<<<<<<< @@ -7835,7 +7973,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_result = (__pyx_v_result + 1); - /* "gensim/models/word2vec_inner.pyx":627 + /* "gensim/models/word2vec_inner.pyx":628 * points[i] = np.PyArray_DATA(word.point) * result += 1 * i += 1 # <<<<<<<<<<<<<< @@ -7844,7 +7982,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_i = (__pyx_v_i + 1); - /* "gensim/models/word2vec_inner.pyx":628 + /* "gensim/models/word2vec_inner.pyx":629 * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -7854,7 +7992,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_i == 0x2710) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":629 + /* "gensim/models/word2vec_inner.pyx":630 * i += 1 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -7863,7 +8001,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L4_break; - /* "gensim/models/word2vec_inner.pyx":628 + /* "gensim/models/word2vec_inner.pyx":629 * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -7872,7 +8010,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } - /* "gensim/models/word2vec_inner.pyx":618 + /* "gensim/models/word2vec_inner.pyx":619 * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -7884,7 +8022,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_L4_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":630 + /* "gensim/models/word2vec_inner.pyx":631 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? * sentence_len = i # <<<<<<<<<<<<<< @@ -7893,7 +8031,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_sentence_len = __pyx_v_i; - /* "gensim/models/word2vec_inner.pyx":633 + /* "gensim/models/word2vec_inner.pyx":634 * * # release GIL & train on the sentence * work[0] = 0.0 # <<<<<<<<<<<<<< @@ -7902,7 +8040,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ (__pyx_v_work[0]) = 0.0; - /* "gensim/models/word2vec_inner.pyx":634 + /* "gensim/models/word2vec_inner.pyx":635 * # release GIL & train on the sentence * work[0] = 0.0 * with nogil: # <<<<<<<<<<<<<< @@ -7917,7 +8055,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( #endif /*try:*/ { - /* "gensim/models/word2vec_inner.pyx":635 + /* "gensim/models/word2vec_inner.pyx":636 * work[0] = 0.0 * with nogil: * for i in range(sentence_len): # <<<<<<<<<<<<<< @@ -7925,10 +8063,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( * continue */ __pyx_t_2 = __pyx_v_sentence_len; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_11 = __pyx_t_2; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_i = __pyx_t_12; - /* "gensim/models/word2vec_inner.pyx":636 + /* "gensim/models/word2vec_inner.pyx":637 * with nogil: * for i in range(sentence_len): * if codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7938,7 +8077,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = (((__pyx_v_codelens[__pyx_v_i]) == 0) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":637 + /* "gensim/models/word2vec_inner.pyx":638 * for i in range(sentence_len): * if codelens[i] == 0: * continue # <<<<<<<<<<<<<< @@ -7947,7 +8086,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L10_continue; - /* "gensim/models/word2vec_inner.pyx":636 + /* "gensim/models/word2vec_inner.pyx":637 * with nogil: * for i in range(sentence_len): * if codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7956,7 +8095,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } - /* "gensim/models/word2vec_inner.pyx":638 + /* "gensim/models/word2vec_inner.pyx":639 * if codelens[i] == 0: * continue * j = i - window # <<<<<<<<<<<<<< @@ -7965,7 +8104,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_j = (__pyx_v_i - __pyx_v_window); - /* "gensim/models/word2vec_inner.pyx":639 + /* "gensim/models/word2vec_inner.pyx":640 * continue * j = i - window * if j < 0: # <<<<<<<<<<<<<< @@ -7975,7 +8114,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_j < 0) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":640 + /* "gensim/models/word2vec_inner.pyx":641 * j = i - window * if j < 0: * j = 0 # <<<<<<<<<<<<<< @@ -7984,7 +8123,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_j = 0; - /* "gensim/models/word2vec_inner.pyx":639 + /* "gensim/models/word2vec_inner.pyx":640 * continue * j = i - window * if j < 0: # <<<<<<<<<<<<<< @@ -7993,7 +8132,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } - /* "gensim/models/word2vec_inner.pyx":641 + /* "gensim/models/word2vec_inner.pyx":642 * if j < 0: * j = 0 * k = i + window + 1 # <<<<<<<<<<<<<< @@ -8002,7 +8141,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_k = ((__pyx_v_i + __pyx_v_window) + 1); - /* "gensim/models/word2vec_inner.pyx":642 + /* "gensim/models/word2vec_inner.pyx":643 * j = 0 * k = i + window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -8012,7 +8151,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_k > __pyx_v_sentence_len) != 0); if (__pyx_t_8) { - /* "gensim/models/word2vec_inner.pyx":643 + /* "gensim/models/word2vec_inner.pyx":644 * k = i + window + 1 * if k > sentence_len: * k = sentence_len # <<<<<<<<<<<<<< @@ -8021,7 +8160,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_k = __pyx_v_sentence_len; - /* "gensim/models/word2vec_inner.pyx":642 + /* "gensim/models/word2vec_inner.pyx":643 * j = 0 * k = i + window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -8030,7 +8169,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } - /* "gensim/models/word2vec_inner.pyx":644 + /* "gensim/models/word2vec_inner.pyx":645 * if k > sentence_len: * k = sentence_len * score_pair_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, work, i, j, k, cbow_mean) # <<<<<<<<<<<<<< @@ -8042,7 +8181,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( } } - /* "gensim/models/word2vec_inner.pyx":634 + /* "gensim/models/word2vec_inner.pyx":635 * # release GIL & train on the sentence * work[0] = 0.0 * with nogil: # <<<<<<<<<<<<<< @@ -8061,7 +8200,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( } } - /* "gensim/models/word2vec_inner.pyx":646 + /* "gensim/models/word2vec_inner.pyx":647 * score_pair_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, work, i, j, k, cbow_mean) * * return work[0] # <<<<<<<<<<<<<< @@ -8069,13 +8208,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( * cdef void score_pair_cbow_hs( */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "gensim/models/word2vec_inner.pyx":588 + /* "gensim/models/word2vec_inner.pyx":589 * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< @@ -8099,7 +8238,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( return __pyx_r; } -/* "gensim/models/word2vec_inner.pyx":648 +/* "gensim/models/word2vec_inner.pyx":649 * return work[0] * * cdef void score_pair_cbow_hs( # <<<<<<<<<<<<<< @@ -8119,19 +8258,20 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PY_LONG_LONG __pyx_t_5; - long __pyx_t_6; + int __pyx_t_5; + PY_LONG_LONG __pyx_t_6; + long __pyx_t_7; - /* "gensim/models/word2vec_inner.pyx":659 + /* "gensim/models/word2vec_inner.pyx":660 * cdef int m * * memset(neu1, 0, size * cython.sizeof(REAL_t)) # <<<<<<<<<<<<<< * count = 0.0 * for m in range(j, k): */ - memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)))); + (void)(memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); - /* "gensim/models/word2vec_inner.pyx":660 + /* "gensim/models/word2vec_inner.pyx":661 * * memset(neu1, 0, size * cython.sizeof(REAL_t)) * count = 0.0 # <<<<<<<<<<<<<< @@ -8140,7 +8280,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_count = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.0); - /* "gensim/models/word2vec_inner.pyx":661 + /* "gensim/models/word2vec_inner.pyx":662 * memset(neu1, 0, size * cython.sizeof(REAL_t)) * count = 0.0 * for m in range(j, k): # <<<<<<<<<<<<<< @@ -8148,28 +8288,29 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ * continue */ __pyx_t_1 = __pyx_v_k; - for (__pyx_t_2 = __pyx_v_j; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_m = __pyx_t_2; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_m = __pyx_t_3; - /* "gensim/models/word2vec_inner.pyx":662 + /* "gensim/models/word2vec_inner.pyx":663 * count = 0.0 * for m in range(j, k): * if m == i or codelens[m] == 0: # <<<<<<<<<<<<<< * continue * else: */ - __pyx_t_4 = ((__pyx_v_m == __pyx_v_i) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_m == __pyx_v_i) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L6_bool_binop_done; } - __pyx_t_4 = (((__pyx_v_codelens[__pyx_v_m]) == 0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = (((__pyx_v_codelens[__pyx_v_m]) == 0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L6_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":663 + /* "gensim/models/word2vec_inner.pyx":664 * for m in range(j, k): * if m == i or codelens[m] == 0: * continue # <<<<<<<<<<<<<< @@ -8178,7 +8319,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ goto __pyx_L3_continue; - /* "gensim/models/word2vec_inner.pyx":662 + /* "gensim/models/word2vec_inner.pyx":663 * count = 0.0 * for m in range(j, k): * if m == i or codelens[m] == 0: # <<<<<<<<<<<<<< @@ -8187,7 +8328,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } - /* "gensim/models/word2vec_inner.pyx":665 + /* "gensim/models/word2vec_inner.pyx":666 * continue * else: * count += ONEF # <<<<<<<<<<<<<< @@ -8197,7 +8338,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ /*else*/ { __pyx_v_count = (__pyx_v_count + __pyx_v_6gensim_6models_14word2vec_inner_ONEF); - /* "gensim/models/word2vec_inner.pyx":666 + /* "gensim/models/word2vec_inner.pyx":667 * else: * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) # <<<<<<<<<<<<<< @@ -8209,17 +8350,17 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_L3_continue:; } - /* "gensim/models/word2vec_inner.pyx":667 + /* "gensim/models/word2vec_inner.pyx":668 * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): # <<<<<<<<<<<<<< * inv_count = ONEF/count * if cbow_mean: */ - __pyx_t_3 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); + if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":668 + /* "gensim/models/word2vec_inner.pyx":669 * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): * inv_count = ONEF/count # <<<<<<<<<<<<<< @@ -8228,7 +8369,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_inv_count = (__pyx_v_6gensim_6models_14word2vec_inner_ONEF / __pyx_v_count); - /* "gensim/models/word2vec_inner.pyx":667 + /* "gensim/models/word2vec_inner.pyx":668 * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): # <<<<<<<<<<<<<< @@ -8237,17 +8378,17 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } - /* "gensim/models/word2vec_inner.pyx":669 + /* "gensim/models/word2vec_inner.pyx":670 * if count > (0.5): * inv_count = ONEF/count * if cbow_mean: # <<<<<<<<<<<<<< * sscal(&size, &inv_count, neu1, &ONE) * */ - __pyx_t_3 = (__pyx_v_cbow_mean != 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_cbow_mean != 0); + if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":670 + /* "gensim/models/word2vec_inner.pyx":671 * inv_count = ONEF/count * if cbow_mean: * sscal(&size, &inv_count, neu1, &ONE) # <<<<<<<<<<<<<< @@ -8256,7 +8397,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_6gensim_6models_14word2vec_inner_sscal((&__pyx_v_size), (&__pyx_v_inv_count), __pyx_v_neu1, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); - /* "gensim/models/word2vec_inner.pyx":669 + /* "gensim/models/word2vec_inner.pyx":670 * if count > (0.5): * inv_count = ONEF/count * if cbow_mean: # <<<<<<<<<<<<<< @@ -8265,7 +8406,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } - /* "gensim/models/word2vec_inner.pyx":672 + /* "gensim/models/word2vec_inner.pyx":673 * sscal(&size, &inv_count, neu1, &ONE) * * for b in range(codelens[i]): # <<<<<<<<<<<<<< @@ -8273,10 +8414,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) */ __pyx_t_1 = (__pyx_v_codelens[__pyx_v_i]); - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) { - __pyx_v_b = __pyx_t_5; + __pyx_t_2 = __pyx_t_1; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { + __pyx_v_b = __pyx_t_6; - /* "gensim/models/word2vec_inner.pyx":673 + /* "gensim/models/word2vec_inner.pyx":674 * * for b in range(codelens[i]): * row2 = word_point[b] * size # <<<<<<<<<<<<<< @@ -8285,7 +8427,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_row2 = ((__pyx_v_word_point[__pyx_v_b]) * __pyx_v_size); - /* "gensim/models/word2vec_inner.pyx":674 + /* "gensim/models/word2vec_inner.pyx":675 * for b in range(codelens[i]): * row2 = word_point[b] * size * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) # <<<<<<<<<<<<<< @@ -8294,7 +8436,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = __pyx_v_6gensim_6models_14word2vec_inner_our_dot((&__pyx_v_size), __pyx_v_neu1, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), (&(__pyx_v_syn1[__pyx_v_row2])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); - /* "gensim/models/word2vec_inner.pyx":675 + /* "gensim/models/word2vec_inner.pyx":676 * row2 = word_point[b] * size * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 # <<<<<<<<<<<<<< @@ -8303,7 +8445,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_sgn = __Pyx_pow_long(-1L, ((long)(__pyx_v_word_code[__pyx_v_b]))); - /* "gensim/models/word2vec_inner.pyx":676 + /* "gensim/models/word2vec_inner.pyx":677 * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn # <<<<<<<<<<<<<< @@ -8312,25 +8454,25 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = (__pyx_v_f * __pyx_v_sgn); - /* "gensim/models/word2vec_inner.pyx":677 + /* "gensim/models/word2vec_inner.pyx":678 * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] */ - __pyx_t_4 = ((__pyx_v_f <= -6.0) != 0); - if (!__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_f <= -6.0) != 0); + if (!__pyx_t_5) { } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; goto __pyx_L13_bool_binop_done; } - __pyx_t_4 = ((__pyx_v_f >= 6.0) != 0); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_f >= 6.0) != 0); + __pyx_t_4 = __pyx_t_5; __pyx_L13_bool_binop_done:; - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":678 + /* "gensim/models/word2vec_inner.pyx":679 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: * continue # <<<<<<<<<<<<<< @@ -8339,7 +8481,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ goto __pyx_L10_continue; - /* "gensim/models/word2vec_inner.pyx":677 + /* "gensim/models/word2vec_inner.pyx":678 * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -8348,7 +8490,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } - /* "gensim/models/word2vec_inner.pyx":679 + /* "gensim/models/word2vec_inner.pyx":680 * if f <= -MAX_EXP or f >= MAX_EXP: * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] # <<<<<<<<<<<<<< @@ -8357,19 +8499,19 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[((int)((__pyx_v_f + 6.0) * 83.0))]); - /* "gensim/models/word2vec_inner.pyx":680 + /* "gensim/models/word2vec_inner.pyx":681 * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] * work[0] += f # <<<<<<<<<<<<<< * * */ - __pyx_t_6 = 0; - (__pyx_v_work[__pyx_t_6]) = ((__pyx_v_work[__pyx_t_6]) + __pyx_v_f); + __pyx_t_7 = 0; + (__pyx_v_work[__pyx_t_7]) = ((__pyx_v_work[__pyx_t_7]) + __pyx_v_f); __pyx_L10_continue:; } - /* "gensim/models/word2vec_inner.pyx":648 + /* "gensim/models/word2vec_inner.pyx":649 * return work[0] * * cdef void score_pair_cbow_hs( # <<<<<<<<<<<<<< @@ -8380,7 +8522,7 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ /* function exit code */ } -/* "gensim/models/word2vec_inner.pyx":683 +/* "gensim/models/word2vec_inner.pyx":684 * * * def init(): # <<<<<<<<<<<<<< @@ -8419,7 +8561,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P int __pyx_t_4; __Pyx_RefNannySetupContext("init", 0); - /* "gensim/models/word2vec_inner.pyx":693 + /* "gensim/models/word2vec_inner.pyx":694 * * cdef int i * cdef float *x = [10.0] # <<<<<<<<<<<<<< @@ -8429,7 +8571,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_1[0] = ((float)10.0); __pyx_v_x = __pyx_t_1; - /* "gensim/models/word2vec_inner.pyx":694 + /* "gensim/models/word2vec_inner.pyx":695 * cdef int i * cdef float *x = [10.0] * cdef float *y = [0.01] # <<<<<<<<<<<<<< @@ -8439,7 +8581,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_2[0] = ((float)0.01); __pyx_v_y = __pyx_t_2; - /* "gensim/models/word2vec_inner.pyx":695 + /* "gensim/models/word2vec_inner.pyx":696 * cdef float *x = [10.0] * cdef float *y = [0.01] * cdef float expected = 0.1 # <<<<<<<<<<<<<< @@ -8448,7 +8590,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_expected = ((float)0.1); - /* "gensim/models/word2vec_inner.pyx":696 + /* "gensim/models/word2vec_inner.pyx":697 * cdef float *y = [0.01] * cdef float expected = 0.1 * cdef int size = 1 # <<<<<<<<<<<<<< @@ -8457,7 +8599,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_size = 1; - /* "gensim/models/word2vec_inner.pyx":701 + /* "gensim/models/word2vec_inner.pyx":702 * * # build the sigmoid table * for i in range(EXP_TABLE_SIZE): # <<<<<<<<<<<<<< @@ -8467,7 +8609,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P for (__pyx_t_3 = 0; __pyx_t_3 < 0x3E8; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "gensim/models/word2vec_inner.pyx":702 + /* "gensim/models/word2vec_inner.pyx":703 * # build the sigmoid table * for i in range(EXP_TABLE_SIZE): * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) # <<<<<<<<<<<<<< @@ -8476,7 +8618,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ (__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)exp(((((__pyx_v_i / ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0x3E8)) * 2.0) - 1.0) * 6.0))); - /* "gensim/models/word2vec_inner.pyx":703 + /* "gensim/models/word2vec_inner.pyx":704 * for i in range(EXP_TABLE_SIZE): * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) * EXP_TABLE[i] = (EXP_TABLE[i] / (EXP_TABLE[i] + 1)) # <<<<<<<<<<<<<< @@ -8485,7 +8627,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ (__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) / ((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) + 1.0))); - /* "gensim/models/word2vec_inner.pyx":704 + /* "gensim/models/word2vec_inner.pyx":705 * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) * EXP_TABLE[i] = (EXP_TABLE[i] / (EXP_TABLE[i] + 1)) * LOG_TABLE[i] = log( EXP_TABLE[i] ) # <<<<<<<<<<<<<< @@ -8495,7 +8637,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)log((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]))); } - /* "gensim/models/word2vec_inner.pyx":707 + /* "gensim/models/word2vec_inner.pyx":708 * * # check whether sdot returns double or float * d_res = dsdot(&size, x, &ONE, y, &ONE) # <<<<<<<<<<<<<< @@ -8504,7 +8646,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_d_res = __pyx_v_6gensim_6models_14word2vec_inner_dsdot((&__pyx_v_size), __pyx_v_x, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), __pyx_v_y, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); - /* "gensim/models/word2vec_inner.pyx":708 + /* "gensim/models/word2vec_inner.pyx":709 * # check whether sdot returns double or float * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res # <<<<<<<<<<<<<< @@ -8513,7 +8655,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_p_res = ((float *)(&__pyx_v_d_res)); - /* "gensim/models/word2vec_inner.pyx":709 + /* "gensim/models/word2vec_inner.pyx":710 * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res * if (abs(d_res - expected) < 0.0001): # <<<<<<<<<<<<<< @@ -8523,7 +8665,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_4 = ((fabs((__pyx_v_d_res - __pyx_v_expected)) < 0.0001) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":710 + /* "gensim/models/word2vec_inner.pyx":711 * p_res = &d_res * if (abs(d_res - expected) < 0.0001): * our_dot = our_dot_double # <<<<<<<<<<<<<< @@ -8532,7 +8674,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_double; - /* "gensim/models/word2vec_inner.pyx":711 + /* "gensim/models/word2vec_inner.pyx":712 * if (abs(d_res - expected) < 0.0001): * our_dot = our_dot_double * our_saxpy = saxpy # <<<<<<<<<<<<<< @@ -8541,7 +8683,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_v_6gensim_6models_14word2vec_inner_saxpy; - /* "gensim/models/word2vec_inner.pyx":712 + /* "gensim/models/word2vec_inner.pyx":713 * our_dot = our_dot_double * our_saxpy = saxpy * return 0 # double # <<<<<<<<<<<<<< @@ -8553,7 +8695,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_r = __pyx_int_0; goto __pyx_L0; - /* "gensim/models/word2vec_inner.pyx":709 + /* "gensim/models/word2vec_inner.pyx":710 * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res * if (abs(d_res - expected) < 0.0001): # <<<<<<<<<<<<<< @@ -8562,7 +8704,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ } - /* "gensim/models/word2vec_inner.pyx":713 + /* "gensim/models/word2vec_inner.pyx":714 * our_saxpy = saxpy * return 0 # double * elif (abs(p_res[0] - expected) < 0.0001): # <<<<<<<<<<<<<< @@ -8572,7 +8714,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_4 = ((fabsf(((__pyx_v_p_res[0]) - __pyx_v_expected)) < 0.0001) != 0); if (__pyx_t_4) { - /* "gensim/models/word2vec_inner.pyx":714 + /* "gensim/models/word2vec_inner.pyx":715 * return 0 # double * elif (abs(p_res[0] - expected) < 0.0001): * our_dot = our_dot_float # <<<<<<<<<<<<<< @@ -8581,7 +8723,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_float; - /* "gensim/models/word2vec_inner.pyx":715 + /* "gensim/models/word2vec_inner.pyx":716 * elif (abs(p_res[0] - expected) < 0.0001): * our_dot = our_dot_float * our_saxpy = saxpy # <<<<<<<<<<<<<< @@ -8590,7 +8732,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_v_6gensim_6models_14word2vec_inner_saxpy; - /* "gensim/models/word2vec_inner.pyx":716 + /* "gensim/models/word2vec_inner.pyx":717 * our_dot = our_dot_float * our_saxpy = saxpy * return 1 # float # <<<<<<<<<<<<<< @@ -8602,7 +8744,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_r = __pyx_int_1; goto __pyx_L0; - /* "gensim/models/word2vec_inner.pyx":713 + /* "gensim/models/word2vec_inner.pyx":714 * our_saxpy = saxpy * return 0 # double * elif (abs(p_res[0] - expected) < 0.0001): # <<<<<<<<<<<<<< @@ -8611,7 +8753,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ } - /* "gensim/models/word2vec_inner.pyx":720 + /* "gensim/models/word2vec_inner.pyx":721 * # neither => use cython loops, no BLAS * # actually, the BLAS is so messed up we'll probably have segfaulted above and never even reach here * our_dot = our_dot_noblas # <<<<<<<<<<<<<< @@ -8621,7 +8763,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P /*else*/ { __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_noblas; - /* "gensim/models/word2vec_inner.pyx":721 + /* "gensim/models/word2vec_inner.pyx":722 * # actually, the BLAS is so messed up we'll probably have segfaulted above and never even reach here * our_dot = our_dot_noblas * our_saxpy = our_saxpy_noblas # <<<<<<<<<<<<<< @@ -8630,7 +8772,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_f_6gensim_6models_14word2vec_inner_our_saxpy_noblas; - /* "gensim/models/word2vec_inner.pyx":722 + /* "gensim/models/word2vec_inner.pyx":723 * our_dot = our_dot_noblas * our_saxpy = our_saxpy_noblas * return 2 # <<<<<<<<<<<<<< @@ -8643,7 +8785,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P goto __pyx_L0; } - /* "gensim/models/word2vec_inner.pyx":683 + /* "gensim/models/word2vec_inner.pyx":684 * * * def init(): # <<<<<<<<<<<<<< @@ -8658,12 +8800,12 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. + * # requirements, and does not yet fulfill the PEP. */ /* Python wrapper */ @@ -8680,7 +8822,6 @@ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx } static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { - int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; @@ -8689,7 +8830,6 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; - int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8697,38 +8837,28 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - char *__pyx_t_7; - __Pyx_RefNannySetupContext("__getbuffer__", 0); - if (__pyx_v_info != NULL) { - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220 - * # of flags - * - * if info == NULL: return # <<<<<<<<<<<<<< - * - * cdef int copy_shape, i, ndim - */ - __pyx_t_1 = ((__pyx_v_info == NULL) != 0); - if (__pyx_t_1) { - __pyx_r = 0; - goto __pyx_L0; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + char *__pyx_t_8; + if (__pyx_v_info == NULL) { + PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); + return -1; } + __Pyx_RefNannySetupContext("__getbuffer__", 0); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":223 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222 * - * cdef int copy_shape, i, ndim + * cdef int i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224 - * cdef int copy_shape, i, ndim + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":223 + * cdef int i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * @@ -8736,59 +8866,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":228 - * ndim = PyArray_NDIM(self) - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 - * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * copy_shape = 1 # <<<<<<<<<<<<<< - * else: - * copy_shape = 0 - */ - __pyx_v_copy_shape = 1; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":228 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 * ndim = PyArray_NDIM(self) * - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * copy_shape = 1 - * else: - */ - goto __pyx_L4; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 - * copy_shape = 1 - * else: - * copy_shape = 0 # <<<<<<<<<<<<<< - * - * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - */ - /*else*/ { - __pyx_v_copy_shape = 0; - } - __pyx_L4:; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * copy_shape = 0 - * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") @@ -8797,10 +8886,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; - goto __pyx_L6_bool_binop_done; + goto __pyx_L4_bool_binop_done; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":234 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":228 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -8809,32 +8898,32 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; - __pyx_L6_bool_binop_done:; + __pyx_L4_bool_binop_done:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * copy_shape = 0 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 + * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - if (__pyx_t_1) { + if (unlikely(__pyx_t_1)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 235, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 235, __pyx_L1_error) + __PYX_ERR(1, 229, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 - * copy_shape = 0 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 + * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): @@ -8842,7 +8931,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8853,10 +8942,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; - goto __pyx_L9_bool_binop_done; + goto __pyx_L7_bool_binop_done; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -8865,31 +8954,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; - __pyx_L9_bool_binop_done:; + __pyx_L7_bool_binop_done:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - if (__pyx_t_1) { + if (unlikely(__pyx_t_1)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 239, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 239, __pyx_L1_error) + __PYX_ERR(1, 233, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8898,35 +8987,35 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":241 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim - * if copy_shape: + * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< - * if copy_shape: + * if sizeof(npy_intp) != sizeof(Py_ssize_t): * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 * info.buf = PyArray_DATA(self) * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - __pyx_t_1 = (__pyx_v_copy_shape != 0); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":240 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< @@ -8935,7 +9024,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":241 * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -8944,7 +9033,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242 * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -8952,10 +9041,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_t_5 = __pyx_t_4; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -8964,7 +9054,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":244 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -8974,17 +9064,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 * info.buf = PyArray_DATA(self) * info.ndim = ndim - * if copy_shape: # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - goto __pyx_L11; + goto __pyx_L9; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":252 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -8994,7 +9084,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -9003,9 +9093,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L11:; + __pyx_L9:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -9014,7 +9104,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -9023,7 +9113,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -9032,7 +9122,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -9041,7 +9131,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -9053,85 +9143,32 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257 * cdef int offset * - * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * - * if not hasfields and not copy_shape: - */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L15_bool_binop_done; - } - __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L15_bool_binop_done:; - if (__pyx_t_1) { - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267 - * if not hasfields and not copy_shape: - * # do not call releasebuffer - * info.obj = None # <<<<<<<<<<<<<< - * else: - * # need to call releasebuffer - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = Py_None; - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 - * cdef bint hasfields = PyDataType_HASFIELDS(descr) - * - * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< - * # do not call releasebuffer - * info.obj = None - */ - goto __pyx_L14; - } - - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 - * else: - * # need to call releasebuffer - * info.obj = self # <<<<<<<<<<<<<< + * info.obj = self # <<<<<<<<<<<<<< * - * if not hasfields: + * if not PyDataType_HASFIELDS(descr): */ - /*else*/ { - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - } - __pyx_L14:; + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * info.obj = self + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 + * info.obj = self * - * if not hasfields: # <<<<<<<<<<<<<< + * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); + __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260 * - * if not hasfields: + * if not PyDataType_HASFIELDS(descr): * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): @@ -9139,8 +9176,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * if not hasfields: + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 + * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): @@ -9148,18 +9185,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0); if (!__pyx_t_2) { - goto __pyx_L20_next_or; + goto __pyx_L15_next_or; } else { } __pyx_t_2 = (__pyx_v_little_endian != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; + goto __pyx_L14_bool_binop_done; } - __pyx_L20_next_or:; + __pyx_L15_next_or:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -9170,36 +9207,36 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; - goto __pyx_L19_bool_binop_done; + goto __pyx_L14_bool_binop_done; } __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_1 = __pyx_t_2; - __pyx_L19_bool_binop_done:; + __pyx_L14_bool_binop_done:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * if not hasfields: + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 + * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - if (__pyx_t_1) { + if (unlikely(__pyx_t_1)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 276, __pyx_L1_error) + __PYX_ERR(1, 263, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 - * if not hasfields: + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 + * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): @@ -9207,7 +9244,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -9219,7 +9256,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"b"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -9230,7 +9267,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"B"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -9241,7 +9278,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"h"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -9252,7 +9289,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"H"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":281 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -9263,7 +9300,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"i"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -9274,7 +9311,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"I"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -9285,7 +9322,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"l"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -9296,7 +9333,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"L"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -9307,7 +9344,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"q"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -9318,7 +9355,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"Q"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -9329,7 +9366,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"f"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -9340,7 +9377,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"d"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -9351,7 +9388,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"g"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -9362,7 +9399,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"Zf"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -9373,7 +9410,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"Zd"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -9384,7 +9421,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_f = ((char *)"Zg"); break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -9396,33 +9433,28 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; default: - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 295, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 295, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(1, 295, __pyx_L1_error) + __PYX_ERR(1, 282, __pyx_L1_error) break; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -9431,7 +9463,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -9441,16 +9473,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_r = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 - * info.obj = self + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 + * info.obj = self * - * if not hasfields: # <<<<<<<<<<<<<< + * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":299 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286 * return * else: * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -9460,7 +9492,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":300 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287 * else: * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -9469,7 +9501,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":301 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288 * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -9478,17 +9510,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":302 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289 * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, * &offset) */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 302, __pyx_L1_error) - __pyx_v_f = __pyx_t_7; + __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error) + __pyx_v_f = __pyx_t_8; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":305 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -9498,12 +9530,12 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_f[0]) = '\x00'; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. + * # requirements, and does not yet fulfill the PEP. */ /* function exit code */ @@ -9511,18 +9543,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + if (__pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { - __Pyx_GOTREF(Py_None); - __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); @@ -9530,7 +9562,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":307 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -9554,7 +9586,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":308 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -9564,7 +9596,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":309 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) # <<<<<<<<<<<<<< @@ -9573,7 +9605,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->format); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":308 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -9582,7 +9614,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":310 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9592,7 +9624,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":311 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":298 * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) # <<<<<<<<<<<<<< @@ -9601,7 +9633,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->strides); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":310 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9610,7 +9642,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":307 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -9622,7 +9654,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":788 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9636,7 +9668,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":789 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -9644,13 +9676,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":788 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9669,7 +9701,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9683,7 +9715,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":792 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -9691,13 +9723,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 792, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9716,7 +9748,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -9730,7 +9762,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -9738,13 +9770,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -9763,7 +9795,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -9777,7 +9809,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -9785,13 +9817,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 798, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":797 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -9810,7 +9842,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":800 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -9824,7 +9856,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":788 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -9832,13 +9864,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 801, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":800 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -9857,7 +9889,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -9871,7 +9903,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -9881,7 +9913,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":792 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -9893,7 +9925,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -9902,7 +9934,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":807 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -9916,7 +9948,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -9931,7 +9963,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -9960,7 +9992,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801 * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -9969,7 +10001,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802 * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -9978,7 +10010,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -9987,21 +10019,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 818, __pyx_L1_error) + __PYX_ERR(1, 805, __pyx_L1_error) } __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 818, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 818, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":819 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -10010,15 +10042,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 819, __pyx_L1_error) + __PYX_ERR(1, 806, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 819, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 819, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":807 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -10027,15 +10059,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(__pyx_v_fields != Py_None)) { PyObject* sequence = __pyx_v_fields; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 820, __pyx_L1_error) + __PYX_ERR(1, 807, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -10043,51 +10071,51 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 820, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 820, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error) } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 820, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 822, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 822, __pyx_L1_error) + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 822, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); - if (__pyx_t_6) { + if (unlikely(__pyx_t_6)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 823, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 823, __pyx_L1_error) + __PYX_ERR(1, 810, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -10096,7 +10124,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10116,7 +10144,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L8_next_or:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -10133,29 +10161,29 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - if (__pyx_t_6) { + if (unlikely(__pyx_t_6)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 827, __pyx_L1_error) + __PYX_ERR(1, 814, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10164,7 +10192,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -10172,15 +10200,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) break; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -10189,7 +10217,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 0x78; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -10198,7 +10226,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -10209,7 +10237,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -10219,7 +10247,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -10229,19 +10257,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":846 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -10249,22 +10277,22 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * */ __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_6) { + if (unlikely(__pyx_t_6)) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 847, __pyx_L1_error) + __PYX_ERR(1, 834, __pyx_L1_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":846 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -10273,252 +10301,252 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":854 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 854, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 854, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 854, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":843 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 856, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 843, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 856, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 843, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":857 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 857, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 857, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 857, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 858, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 858, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 845, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 858, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 845, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":859 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":846 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 859, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 859, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 846, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 859, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 860, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 847, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 860, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 847, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":861 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 861, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 861, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 848, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 861, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":862 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 862, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 862, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 849, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 862, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 849, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":863 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 863, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10527,18 +10555,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":864 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 864, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 864, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 864, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10547,18 +10575,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":865 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 865, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 865, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10567,25 +10595,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":866 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 866, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 866, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 866, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (likely(__pyx_t_6)) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":868 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -10593,23 +10621,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * else: */ /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 868, __pyx_L1_error) + __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 868, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 868, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 868, __pyx_L1_error) + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 855, __pyx_L1_error) } __pyx_L15:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":869 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -10618,7 +10641,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -10628,7 +10651,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":873 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -10636,12 +10659,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * */ /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 873, __pyx_L1_error) + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error) __pyx_v_f = __pyx_t_9; } __pyx_L13:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -10651,7 +10674,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":874 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":861 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -10661,7 +10684,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -10686,7 +10709,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":990 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -10701,7 +10724,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -10712,7 +10735,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -10721,7 +10744,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_baseptr = NULL; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -10731,7 +10754,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a goto __pyx_L3; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":982 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -10741,7 +10764,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a /*else*/ { Py_INCREF(__pyx_v_base); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":983 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -10752,7 +10775,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":984 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -10761,7 +10784,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -10770,7 +10793,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":990 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -10782,7 +10805,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -10796,7 +10819,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -10806,7 +10829,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -10814,11 +10837,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return arr.base */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -10827,7 +10849,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1004 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -10841,7 +10863,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py goto __pyx_L0; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -10856,7 +10878,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -10877,7 +10899,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10893,16 +10915,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1011 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998 * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1011, __pyx_L3_error) + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10916,7 +10938,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999 * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< @@ -10926,28 +10948,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1012, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1013 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1013, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1013, __pyx_L5_except_error) + __PYX_ERR(1, 1000, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10962,7 +10984,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -10985,7 +11007,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1015 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -11006,7 +11028,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1016 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -11022,16 +11044,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1017 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1004 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1017, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1016 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -11045,7 +11067,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1018 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1005 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -11055,28 +11077,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1018, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1019 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1019, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1019, __pyx_L5_except_error) + __PYX_ERR(1, 1006, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1016 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -11091,7 +11113,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1015 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -11114,7 +11136,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } -/* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1021 +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -11135,7 +11157,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -11151,16 +11173,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1023, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error) - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -11174,7 +11196,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1011 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -11183,26 +11205,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1024, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1025 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1025, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1025, __pyx_L5_except_error) + __PYX_ERR(1, 1012, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -11217,7 +11239,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1021 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -11302,6 +11324,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_cum_table_len, __pyx_k_cum_table_len, sizeof(__pyx_k_cum_table_len), 0, 0, 1, 1}, {&__pyx_n_s_d_res, __pyx_k_d_res, sizeof(__pyx_k_d_res), 0, 0, 1, 1}, {&__pyx_n_s_dsdot, __pyx_k_dsdot, sizeof(__pyx_k_dsdot), 0, 0, 1, 1}, + {&__pyx_n_s_effective_samples, __pyx_k_effective_samples, sizeof(__pyx_k_effective_samples), 0, 0, 1, 1}, {&__pyx_n_s_effective_sentences, __pyx_k_effective_sentences, sizeof(__pyx_k_effective_sentences), 0, 0, 1, 1}, {&__pyx_n_s_effective_words, __pyx_k_effective_words, sizeof(__pyx_k_effective_words), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, @@ -11309,7 +11332,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_fblas, __pyx_k_fblas, sizeof(__pyx_k_fblas), 0, 0, 1, 1}, {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, {&__pyx_n_s_gensim_models_word2vec_inner, __pyx_k_gensim_models_word2vec_inner, sizeof(__pyx_k_gensim_models_word2vec_inner), 0, 0, 1, 1}, - {&__pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_k_gensim_models_word2vec_inner_pyx, sizeof(__pyx_k_gensim_models_word2vec_inner_pyx), 0, 0, 1, 0}, {&__pyx_n_s_hs, __pyx_k_hs, sizeof(__pyx_k_hs), 0, 0, 1, 1}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_idx_end, __pyx_k_idx_end, sizeof(__pyx_k_idx_end), 0, 0, 1, 1}, @@ -11323,6 +11345,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1}, + {&__pyx_kp_s_models_word2vec_inner_pyx, __pyx_k_models_word2vec_inner_pyx, sizeof(__pyx_k_models_word2vec_inner_pyx), 0, 0, 1, 0}, {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_negative, __pyx_k_negative, sizeof(__pyx_k_negative), 0, 0, 1, 1}, @@ -11346,6 +11369,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, {&__pyx_n_s_running_training_loss, __pyx_k_running_training_loss, sizeof(__pyx_k_running_training_loss), 0, 0, 1, 1}, {&__pyx_n_s_running_training_loss_2, __pyx_k_running_training_loss_2, sizeof(__pyx_k_running_training_loss_2), 0, 0, 1, 1}, + {&__pyx_n_s_running_training_loss_sample, __pyx_k_running_training_loss_sample, sizeof(__pyx_k_running_training_loss_sample), 0, 0, 1, 1}, {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1}, {&__pyx_n_s_sample_int, __pyx_k_sample_int, sizeof(__pyx_k_sample_int), 0, 0, 1, 1}, {&__pyx_n_s_saxpy, __pyx_k_saxpy, sizeof(__pyx_k_saxpy), 0, 0, 1, 1}, @@ -11392,8 +11416,8 @@ static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 21, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 376, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 235, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 823, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -11417,114 +11441,114 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "gensim/models/word2vec_inner.pyx":448 + /* "gensim/models/word2vec_inner.pyx":449 * cum_table_len = len(model.vocabulary.cum_table) * if negative or sample: * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ - __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 235, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 239, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 276, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 823, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 814, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1013 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 1013, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 1000, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1019 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1019, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1006, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1025 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1025, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); @@ -11535,58 +11559,58 @@ static int __Pyx_InitCachedConstants(void) { * cdef int hs = model.hs * cdef int negative = model.negative */ - __pyx_tuple__15 = PyTuple_Pack(40, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(42, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_effective_samples, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item, __pyx_n_s_running_training_loss_sample); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(5, 0, 40, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_train_batch_sg, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 296, __pyx_L1_error) + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(5, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_train_batch_sg, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 296, __pyx_L1_error) - /* "gensim/models/word2vec_inner.pyx":403 + /* "gensim/models/word2vec_inner.pyx":404 * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< * cdef int hs = model.hs * cdef int negative = model.negative */ - __pyx_tuple__17 = PyTuple_Pack(43, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_cbow_mean, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_neu1_2, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(43, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_cbow_mean, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_neu1_2, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(6, 0, 43, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_train_batch_cbow, 403, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(6, 0, 43, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_train_batch_cbow, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 404, __pyx_L1_error) - /* "gensim/models/word2vec_inner.pyx":510 + /* "gensim/models/word2vec_inner.pyx":511 * * # Score is only implemented for hierarchical softmax * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) */ - __pyx_tuple__19 = PyTuple_Pack(20, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(20, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_sg, 510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_sg, 511, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 511, __pyx_L1_error) - /* "gensim/models/word2vec_inner.pyx":588 + /* "gensim/models/word2vec_inner.pyx":589 * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< * * cdef int cbow_mean = model.cbow_mean */ - __pyx_tuple__21 = PyTuple_Pack(23, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_cbow_mean, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_neu1_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(23, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_cbow_mean, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_neu1_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_cbow, 588, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_cbow, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 589, __pyx_L1_error) - /* "gensim/models/word2vec_inner.pyx":683 + /* "gensim/models/word2vec_inner.pyx":684 * * * def init(): # <<<<<<<<<<<<<< * """ * Precompute function `sigmoid(x) = 1 / (1 + exp(-x))`, for x values discretized */ - __pyx_tuple__23 = PyTuple_Pack(7, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_expected, __pyx_n_s_size, __pyx_n_s_d_res, __pyx_n_s_p_res); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(7, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_expected, __pyx_n_s_size, __pyx_n_s_d_res, __pyx_n_s_p_res); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_init, 683, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_init, 684, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11606,12 +11630,137 @@ static int __Pyx_InitGlobals(void) { return -1; } +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + if (__Pyx_ExportVoidPtr(__pyx_n_s_scopy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_scopy, "__pyx_t_6gensim_6models_14word2vec_inner_scopy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_saxpy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_saxpy, "__pyx_t_6gensim_6models_14word2vec_inner_saxpy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_sdot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_sdot, "__pyx_t_6gensim_6models_14word2vec_inner_sdot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_dsdot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_dsdot, "__pyx_t_6gensim_6models_14word2vec_inner_dsdot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_snrm2, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_snrm2, "__pyx_t_6gensim_6models_14word2vec_inner_snrm2_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_sscal, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_sscal, "__pyx_t_6gensim_6models_14word2vec_inner_sscal_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_EXP_TABLE, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t [0x3E8]") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_our_dot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_our_dot, "__pyx_t_6gensim_6models_14word2vec_inner_our_dot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportVoidPtr(__pyx_n_s_our_saxpy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_our_saxpy, "__pyx_t_6gensim_6models_14word2vec_inner_our_saxpy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("our_dot_double", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_double, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("our_dot_float", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_float, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("our_dot_noblas", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_noblas, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("our_saxpy_noblas", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_saxpy_noblas, "void (int const *, float const *, float const *, int const *, float *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("bisect_left", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_bisect_left, "unsigned PY_LONG_LONG (__pyx_t_5numpy_uint32_t *, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("random_int32", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_random_int32, "unsigned PY_LONG_LONG (unsigned PY_LONG_LONG *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION < 3 +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC void +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#else +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) + #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + + #if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initword2vec_inner(void); /*proto*/ -PyMODINIT_FUNC initword2vec_inner(void) +__Pyx_PyMODINIT_FUNC initword2vec_inner(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initword2vec_inner(void) #else -PyMODINIT_FUNC PyInit_word2vec_inner(void); /*proto*/ -PyMODINIT_FUNC PyInit_word2vec_inner(void) +__Pyx_PyMODINIT_FUNC PyInit_word2vec_inner(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_word2vec_inner(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); @@ -11667,17 +11816,19 @@ static int __pyx_pymod_exec_word2vec_inner(PyObject *__pyx_pyinit_module) __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_word2vec_inner(void)", 0); +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_word2vec_inner(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -11732,55 +11883,29 @@ static int __pyx_pymod_exec_word2vec_inner(PyObject *__pyx_pyinit_module) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - if (__pyx_module_is_main_gensim__models__word2vec_inner) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "gensim.models.word2vec_inner")) { - if (unlikely(PyDict_SetItemString(modules, "gensim.models.word2vec_inner", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - if (__Pyx_ExportVoidPtr(__pyx_n_s_scopy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_scopy, "__pyx_t_6gensim_6models_14word2vec_inner_scopy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_saxpy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_saxpy, "__pyx_t_6gensim_6models_14word2vec_inner_saxpy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_sdot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_sdot, "__pyx_t_6gensim_6models_14word2vec_inner_sdot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_dsdot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_dsdot, "__pyx_t_6gensim_6models_14word2vec_inner_dsdot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_snrm2, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_snrm2, "__pyx_t_6gensim_6models_14word2vec_inner_snrm2_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_sscal, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_sscal, "__pyx_t_6gensim_6models_14word2vec_inner_sscal_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_EXP_TABLE, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t [0x3E8]") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_our_dot, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_our_dot, "__pyx_t_6gensim_6models_14word2vec_inner_our_dot_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportVoidPtr(__pyx_n_s_our_saxpy, (void *)&__pyx_v_6gensim_6models_14word2vec_inner_our_saxpy, "__pyx_t_6gensim_6models_14word2vec_inner_our_saxpy_ptr") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Function export code ---*/ - if (__Pyx_ExportFunction("our_dot_double", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_double, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("our_dot_float", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_float, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("our_dot_noblas", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_dot_noblas, "__pyx_t_6gensim_6models_14word2vec_inner_REAL_t (int const *, float const *, int const *, float const *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("our_saxpy_noblas", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_saxpy_noblas, "void (int const *, float const *, float const *, int const *, float *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("bisect_left", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_bisect_left, "unsigned PY_LONG_LONG (__pyx_t_5numpy_uint32_t *, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("random_int32", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_random_int32, "unsigned PY_LONG_LONG (unsigned PY_LONG_LONG *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Type init code ---*/ - /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", - #if CYTHON_COMPILING_IN_PYPY - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), + if (__pyx_module_is_main_gensim__models__word2vec_inner) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "gensim.models.word2vec_inner")) { + if (unlikely(PyDict_SetItemString(modules, "gensim.models.word2vec_inner", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 163, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 185, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 189, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 198, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 885, __pyx_L1_error) - /*--- Variable import code ---*/ - /*--- Function import code ---*/ + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + if (unlikely(__Pyx_modinit_variable_export_code() != 0)) goto __pyx_L1_error; + if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_type_init_code(); + if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error; + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -12064,101 +12189,86 @@ static int __pyx_pymod_exec_word2vec_inner(PyObject *__pyx_pyinit_module) if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_sg, __pyx_t_1) < 0) __PYX_ERR(0, 296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":403 + /* "gensim/models/word2vec_inner.pyx":404 * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< * cdef int hs = model.hs * cdef int negative = model.negative */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_3train_batch_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_3train_batch_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 403, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":510 + /* "gensim/models/word2vec_inner.pyx":511 * * # Score is only implemented for hierarchical softmax * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_5score_sentence_sg, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_5score_sentence_sg, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_sg, __pyx_t_1) < 0) __PYX_ERR(0, 510, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_sg, __pyx_t_1) < 0) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":588 + /* "gensim/models/word2vec_inner.pyx":589 * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< * * cdef int cbow_mean = model.cbow_mean */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_7score_sentence_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_7score_sentence_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 588, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":683 + /* "gensim/models/word2vec_inner.pyx":684 * * * def init(): # <<<<<<<<<<<<<< * """ * Precompute function `sigmoid(x) = 1 / (1 + exp(-x))`, for x values discretized */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_9init, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_9init, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 683, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "gensim/models/word2vec_inner.pyx":724 + /* "gensim/models/word2vec_inner.pyx":725 * return 2 * * FAST_VERSION = init() # initialize the module # <<<<<<<<<<<<<< * MAX_WORDS_IN_BATCH = MAX_SENTENCE_LEN */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_init); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error) - } + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FAST_VERSION, __pyx_t_1) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FAST_VERSION, __pyx_t_7) < 0) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "gensim/models/word2vec_inner.pyx":725 + /* "gensim/models/word2vec_inner.pyx":726 * * FAST_VERSION = init() # initialize the module * MAX_WORDS_IN_BATCH = MAX_SENTENCE_LEN # <<<<<<<<<<<<<< */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WORDS_IN_BATCH, __pyx_int_10000) < 0) __PYX_ERR(0, 725, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WORDS_IN_BATCH, __pyx_int_10000) < 0) __PYX_ERR(0, 726, __pyx_L1_error) /* "gensim/models/word2vec_inner.pyx":1 * #!/usr/bin/env cython # <<<<<<<<<<<<<< * # cython: boundscheck=False * # cython: wraparound=False */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "../../.local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1021 + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12212,6 +12322,20 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); @@ -12401,6 +12525,122 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; + } + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); +} +#endif + /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL #include "frameobject.h" @@ -12544,6 +12784,20 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P } #endif +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { @@ -12727,6 +12981,85 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, @@ -12748,7 +13081,7 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 + #if PY_VERSION_HEX >= 0x030700A3 *type = tstate->exc_state.exc_type; *value = tstate->exc_state.exc_value; *tb = tstate->exc_state.exc_traceback; @@ -12763,7 +13096,7 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 + #if PY_VERSION_HEX >= 0x030700A3 tmp_type = tstate->exc_state.exc_type; tmp_value = tstate->exc_state.exc_value; tmp_tb = tstate->exc_state.exc_traceback; @@ -12847,7 +13180,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 + #if PY_VERSION_HEX >= 0x030700A3 tmp_type = tstate->exc_state.exc_type; tmp_value = tstate->exc_state.exc_value; tmp_tb = tstate->exc_state.exc_traceback; @@ -12962,10 +13295,19 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + if (likely(result)) { + Py_INCREF(result); + } else if (unlikely(PyErr_Occurred())) { + result = NULL; + } else { +#else result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { +#endif #else result = PyObject_GetItem(__pyx_d, name); if (!result) { @@ -12976,68 +13318,8 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return result; } -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - /* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -13058,18 +13340,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK + #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { - use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); } else #endif { @@ -13095,7 +13380,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -13175,7 +13460,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -13260,7 +13545,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -13291,7 +13576,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -13313,7 +13598,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* None */ - static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { + static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { long t = b; switch (e) { case 3: @@ -13340,7 +13625,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -13371,7 +13656,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -13402,7 +13687,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -13422,7 +13707,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -13557,7 +13842,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -13577,7 +13862,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -13712,7 +13997,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -13743,7 +14028,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { + static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -13932,7 +14217,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -14121,7 +14406,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { + static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -14310,7 +14595,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { + static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { const npy_uint32 neg_one = (npy_uint32) -1, const_zero = (npy_uint32) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -14499,7 +14784,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -14688,7 +14973,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -14743,14 +15028,42 @@ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, return res; } #endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; ip) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -14953,7 +15266,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) - PyErr_Clear(); + return -1; ++t; } return 0; @@ -15167,6 +15480,9 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff --git a/gensim/models/word2vec_inner.pyx b/gensim/models/word2vec_inner.pyx index 98e719c6d4..bc56928eaa 100755 --- a/gensim/models/word2vec_inner.pyx +++ b/gensim/models/word2vec_inner.pyx @@ -298,8 +298,8 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): cdef int negative = model.negative cdef int sample = (model.vocabulary.sample != 0) - cdef int _compute_loss = (1 if compute_loss == True else 0) - cdef REAL_t _running_training_loss = model.running_training_loss + cdef int _compute_loss = (1 if compute_loss is True else 0) + cdef REAL_t _running_training_loss = 0 cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) @@ -314,7 +314,7 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): cdef int window = model.window cdef int i, j, k - cdef int effective_words = 0, effective_sentences = 0 + cdef int effective_words = 0, effective_sentences = 0, effective_samples = 0 cdef int sent_idx, idx_start, idx_end # For hierarchical softmax @@ -388,16 +388,17 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): k = i + window + 1 - reduced_windows[i] if k > idx_end: k = idx_end + _running_training_loss_sample = 0 for j in range(j, k): if j == i: continue + effective_samples += 1 if hs: fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) if negative: next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) - - model.running_training_loss = _running_training_loss - return effective_words + model.running_training_loss += _running_training_loss + return effective_words, effective_samples def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): @@ -406,8 +407,8 @@ def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): cdef int sample = (model.vocabulary.sample != 0) cdef int cbow_mean = model.cbow_mean - cdef int _compute_loss = (1 if compute_loss == True else 0) - cdef REAL_t _running_training_loss = model.running_training_loss + cdef int _compute_loss = (1 if compute_loss is True else 0) + cdef REAL_t _running_training_loss = 0 cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) @@ -502,8 +503,8 @@ def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): if negative: next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) - model.running_training_loss = _running_training_loss - return effective_words + model.running_training_loss += _running_training_loss + return effective_words, effective_words # Score is only implemented for hierarchical softmax diff --git a/gensim/scripts/word2vec_standalone.py b/gensim/scripts/word2vec_standalone.py index 57f4d907ba..2bd7e5297c 100644 --- a/gensim/scripts/word2vec_standalone.py +++ b/gensim/scripts/word2vec_standalone.py @@ -45,6 +45,8 @@ Compute accuracy of the resulting model analogical inference power on questions file See an example of questions file at https://code.google.com/p/word2vec/source/browse/trunk/questions-words.txt + -loss + If true, the loss will be computed and printed during training Example: python -m gensim.scripts.word2vec_standalone -train data.txt \ -output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 @@ -105,6 +107,8 @@ type=int, default=0, choices=[0, 1] ) parser.add_argument("-accuracy", help="Use questions from file ACCURACY to evaluate the model") + parser.add_argument("-loss", help="Should the loss will be computed and printed during training", + action="store_true") args = parser.parse_args() @@ -122,7 +126,8 @@ model = Word2Vec( corpus, size=args.size, min_count=args.min_count, workers=args.threads, window=args.window, sample=args.sample, alpha=args.alpha, sg=skipgram, - hs=args.hs, negative=args.negative, cbow_mean=1, iter=args.iter + hs=args.hs, negative=args.negative, cbow_mean=1, iter=args.iter, + compute_loss=args.loss ) if args.output: From a6548c4ec03eac1cf72cd3b5246172aeb1db14be Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 11:42:04 +0200 Subject: [PATCH 02/13] Fixing docstring --- gensim/scripts/word2vec_standalone.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gensim/scripts/word2vec_standalone.py b/gensim/scripts/word2vec_standalone.py index 2bd7e5297c..2c3e7e890b 100644 --- a/gensim/scripts/word2vec_standalone.py +++ b/gensim/scripts/word2vec_standalone.py @@ -7,7 +7,7 @@ """ USAGE: %(program)s -train CORPUS -output VECTORS -size SIZE -window WINDOW -cbow CBOW -sample SAMPLE -hs HS -negative NEGATIVE -threads THREADS -iter ITER --min_count MIN-COUNT -alpha ALPHA -binary BINARY -accuracy FILE +-min_count MIN-COUNT -alpha ALPHA -binary BINARY -accuracy FILE [-loss] Trains a neural embedding model on text file CORPUS. Parameters essentially reproduce those used by the original C tool @@ -45,11 +45,12 @@ Compute accuracy of the resulting model analogical inference power on questions file See an example of questions file at https://code.google.com/p/word2vec/source/browse/trunk/questions-words.txt - -loss - If true, the loss will be computed and printed during training + -loss <> + If present, the loss will be computed and printed during training Example: python -m gensim.scripts.word2vec_standalone -train data.txt \ -output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 + """ From a2fd34063e0d540b07d3d8a5823175911021580e Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 12:25:38 +0200 Subject: [PATCH 03/13] Fixing flake8 error line too long --- gensim/models/base_any2vec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 206c637a64..2538a44365 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -1201,7 +1201,8 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot # examples-based progress % if self.compute_loss: logger.info( - "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + ("EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, " + "in_qsize %i, out_qsize %i, current_loss %.3f"), cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, utils.qsize(job_queue), utils.qsize(progress_queue), loss ) @@ -1221,7 +1222,8 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot ) else: logger.info( - "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + ("EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, " + "in_qsize %i, out_qsize %i, current_loss %.3f"), cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, utils.qsize(job_queue), utils.qsize(progress_queue), loss ) From 1bdd4a51e5d54cdf55a801b3ab1b624852a45d63 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 13:08:32 +0200 Subject: [PATCH 04/13] Fixing compatibility issues with Doc2Vec --- gensim/models/base_any2vec.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 2538a44365..72dae1c3a8 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -177,8 +177,16 @@ def _worker_loop(self, job_queue, progress_queue): for callback in self.callbacks: callback.on_batch_begin(self) - tally, raw_tally, effective_samples = self._do_train_job( + stats_tuple = self._do_train_job( data_iterable, job_parameters, thread_private_mem) + if len(stats_tuple) == 3: + tally, raw_tally, effective_samples = stats_tuple + else: + # Model doesn't implement the samples tallying. We assume + # that the number of samples is the effective words tally. This + # gives coherent outputs with previous implementaitons + tally, raw_tally = stats_tuple + effective_samples = tally for callback in self.callbacks: callback.on_batch_end(self) @@ -981,6 +989,10 @@ def train(self, sentences=None, input_streams=None, total_examples=None, total_w total_words=total_words, epochs=epochs, start_alpha=start_alpha, end_alpha=end_alpha, word_count=word_count, queue_factor=queue_factor, report_delay=report_delay, compute_loss=compute_loss, callbacks=callbacks) + + def get_latest_training_loss(self): + return 0 + def _get_job_params(self, cur_epoch): """Get the learning rate used in the current epoch. From 7b457d69063dad2c8e3f323575dd3262be57f64d Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 14:20:24 +0200 Subject: [PATCH 05/13] Fixing pep8 --- gensim/models/base_any2vec.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 72dae1c3a8..449b9d7e2f 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -989,7 +989,6 @@ def train(self, sentences=None, input_streams=None, total_examples=None, total_w total_words=total_words, epochs=epochs, start_alpha=start_alpha, end_alpha=end_alpha, word_count=word_count, queue_factor=queue_factor, report_delay=report_delay, compute_loss=compute_loss, callbacks=callbacks) - def get_latest_training_loss(self): return 0 From 18735e22762b9514ca2e8de2c1c6e9f0e7cfc825 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Mon, 6 Aug 2018 10:20:56 +0200 Subject: [PATCH 06/13] Some refactoring and docstring fixing --- gensim/models/base_any2vec.py | 80 +++++++++++++------------------- gensim/models/word2vec.py | 5 ++ gensim/models/word2vec_inner.pyx | 9 +++- 3 files changed, 45 insertions(+), 49 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 449b9d7e2f..15cc8bce20 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -124,15 +124,19 @@ def _clear_post_train(self): raise NotImplementedError() def _do_train_job(self, data_iterable, job_parameters, thread_private_mem): - """Train a single batch. Return 3-tuple - `(effective word count, total word count, total samples used)`. - - The total samples used is the same as the effective word count when - using CBOW, but it can differ with Skip-Gram, since a random number of - positve examples are used for each effective word. - - Knowing the effective number of samples used allows us to compute the - average loss for an epoch. + """Train a single batch. + ` + Returns + ------- + (int, int, int) + effective_word_count: int + The number of words processed after ignoring unknown words and sentence length trimming. + total_word_count: int + The total number of words in this batch. + total_samples_used: int + The total samples used while training on this data. This is the same as the effective word count when using + CBOW, but it can differ with Skip-Gram, since a random number of positve examples are used for each average + loss for an epoch. """ raise NotImplementedError() @@ -182,9 +186,10 @@ def _worker_loop(self, job_queue, progress_queue): if len(stats_tuple) == 3: tally, raw_tally, effective_samples = stats_tuple else: - # Model doesn't implement the samples tallying. We assume - # that the number of samples is the effective words tally. This - # gives coherent outputs with previous implementaitons + # TODO: Some models haven't updated their _do_train_job method to return a 3-tuple instead of a + # 2-tuple, containing also the number of samples used while processing the batch. + # For those models that don't implement samples tallying, We assume that the number of samples is the + # effective words tally. This gives coherent outputs with previous implementations. tally, raw_tally = stats_tuple effective_samples = tally @@ -192,8 +197,7 @@ def _worker_loop(self, job_queue, progress_queue): callback.on_batch_end(self) # report back progress - progress_queue.put( - (len(data_iterable), tally, raw_tally, effective_samples)) + progress_queue.put((len(data_iterable), tally, raw_tally, effective_samples)) jobs_processed += 1 logger.debug("worker exiting, processed %i jobs", jobs_processed) @@ -269,7 +273,7 @@ def _job_producer(self, data_iterator, job_queue, cur_epoch=0, total_examples=No logger.debug("job loop exiting, total %i jobs", job_no) def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, total_samples, elapsed): + raw_word_count, total_words, trained_word_count, elapsed): raise NotImplementedError() def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, @@ -990,7 +994,7 @@ def train(self, sentences=None, input_streams=None, total_examples=None, total_w queue_factor=queue_factor, report_delay=report_delay, compute_loss=compute_loss, callbacks=callbacks) def get_latest_training_loss(self): - return 0 + raise NotImplementedError("To compute the loss for a model, you must implement get_latest_training_loss") def _get_job_params(self, cur_epoch): """Get the learning rate used in the current epoch. @@ -1204,40 +1208,22 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot Elapsed time since the beginning of training in seconds. """ - if total_samples == 0: - loss = -1 - else: - loss = self.get_latest_training_loss() / total_samples if total_examples: - # examples-based progress % - if self.compute_loss: - logger.info( - ("EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, " - "in_qsize %i, out_qsize %i, current_loss %.3f"), - cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue), loss - ) - else: - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue) - ) + div = total_examples else: - # words-based progress % - if self.compute_loss: - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue) - ) + div = total_words + + msg = "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i" + args = (cur_epoch + 1, 100.0 * example_count / div, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue)) + if self.compute_loss: + if total_samples == 0: + loss = -1 else: - logger.info( - ("EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, " - "in_qsize %i, out_qsize %i, current_loss %.3f"), - cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, - utils.qsize(job_queue), utils.qsize(progress_queue), loss - ) + loss = self.get_latest_training_loss() / total_samples + msg += ", current_loss %.3f" + args += (loss,) + logger.info(msg, *args) def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, trained_word_count, elapsed): diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index b7d3538630..4beb680037 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -178,6 +178,8 @@ def train_batch_sg(model, sentences, alpha, work=None, compute_loss=False): int Number of words in the vocabulary actually used for training (that already existed in the vocabulary and were not discarded by negative sampling). + int + Number of samples used for training. A sample is a positive/negative example. """ result = 0 @@ -231,6 +233,9 @@ def train_batch_cbow(model, sentences, alpha, work=None, neu1=None, compute_loss int Number of words in the vocabulary actually used for training (that already existed in the vocabulary and were not discarded by negative sampling). + int + Number of samples used for training. A sample is a positive/negative example. In the case of CBOW + this is the same as the effective number of words. """ result = 0 diff --git a/gensim/models/word2vec_inner.pyx b/gensim/models/word2vec_inner.pyx index a5a7cca7a2..7ea3c29b49 100755 --- a/gensim/models/word2vec_inner.pyx +++ b/gensim/models/word2vec_inner.pyx @@ -485,13 +485,15 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): int Number of words in the vocabulary actually used for training (They already existed in the vocabulary and were not discarded by negative sampling). + int + Number of samples used for training. A sample is a positive/negative example. """ cdef int hs = model.hs cdef int negative = model.negative cdef int sample = (model.vocabulary.sample != 0) - cdef int _compute_loss = (1 if compute_loss is True else 0) + cdef int _compute_loss = (1 if compute_loss else 0) cdef REAL_t _running_training_loss = 0 cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) @@ -619,13 +621,16 @@ def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): int Number of words in the vocabulary actually used for training (They already existed in the vocabulary and were not discarded by negative sampling). + int + Number of samples used for training. A sample is a positive/negative example. In the case of CBOW + this is the same as the effective number of words. """ cdef int hs = model.hs cdef int negative = model.negative cdef int sample = (model.vocabulary.sample != 0) cdef int cbow_mean = model.cbow_mean - cdef int _compute_loss = (1 if compute_loss is True else 0) + cdef int _compute_loss = (1 if compute_loss else 0) cdef REAL_t _running_training_loss = 0 cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) From 0bcae41e13eca24d05a73a77aa1f37ca0afd826c Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Tue, 14 Aug 2018 15:29:03 +0200 Subject: [PATCH 07/13] Fixing the progress unit --- gensim/models/base_any2vec.py | 7 ++++--- gensim/models/word2vec.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 15cc8bce20..232424d3f5 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -285,7 +285,6 @@ def _log_train_end(self, raw_word_count, trained_word_count, total_elapsed, job_ def _log_epoch_progress(self, progress_queue, job_queue, cur_epoch=0, total_examples=None, total_words=None, report_delay=1.0): - """Get the progress report for a single training epoch. Parameters @@ -1209,12 +1208,14 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot """ if total_examples: + progress_unit = "examples" div = total_examples else: div = total_words + progress_unit = "words" - msg = "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i" - args = (cur_epoch + 1, 100.0 * example_count / div, trained_word_count / elapsed, + msg = "EPOCH %i - PROGRESS: at %.2f%% %s, %.0f words/s, in_qsize %i, out_qsize %i" + args = (cur_epoch + 1, 100.0 * example_count / div, progress_unit, trained_word_count / elapsed, utils.qsize(job_queue), utils.qsize(progress_queue)) if self.compute_loss: if total_samples == 0: diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index 4beb680037..2ad21ec89c 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -779,9 +779,9 @@ def _do_train_job(self, sentences, alpha, inits): """ work, neu1 = inits if self.sg: - (tally, effective_samples) = train_batch_sg(self, sentences, alpha, work, self.compute_loss) + tally, effective_samples = train_batch_sg(self, sentences, alpha, work, self.compute_loss) else: - (tally, effective_samples) = train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) + tally, effective_samples = train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) return tally, self._raw_word_count(sentences), effective_samples def _clear_post_train(self): From 00e7b7dc52c3c56f05c21a6b2c1f7ed38b8b0714 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Mon, 1 Oct 2018 10:44:23 +0200 Subject: [PATCH 08/13] Adding the tallying for effective samples in the new corpus_file train functions --- gensim/models/base_any2vec.py | 4 ++-- gensim/models/word2vec.py | 10 +++++----- gensim/models/word2vec_corpusfile.pyx | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 442cdf8467..2acbf54056 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -184,11 +184,11 @@ def _worker_loop_corpusfile(self, corpus_file, thread_id, offset, cython_vocab, """ thread_private_mem = self._get_thread_working_mem() - examples, tally, raw_tally = self._do_train_epoch( + examples, tally, raw_tally, effective_samples = self._do_train_epoch( corpus_file, thread_id, offset, cython_vocab, thread_private_mem, cur_epoch, total_examples=total_examples, total_words=total_words, **kwargs) - progress_queue.put((examples, tally, raw_tally)) + progress_queue.put((examples, tally, raw_tally, effective_samples)) progress_queue.put(None) def _worker_loop(self, job_queue, progress_queue): diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index 36a42d3610..ef4446f309 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -778,13 +778,13 @@ def _do_train_epoch(self, corpus_file, thread_id, offset, cython_vocab, thread_p work, neu1 = thread_private_mem if self.sg: - examples, tally, raw_tally = train_epoch_sg(self, corpus_file, offset, cython_vocab, cur_epoch, - total_examples, total_words, work, neu1, self.compute_loss) + train_fct = train_epoch_sg else: - examples, tally, raw_tally = train_epoch_cbow(self, corpus_file, offset, cython_vocab, cur_epoch, - total_examples, total_words, work, neu1, self.compute_loss) + train_fct = train_epoch_cbow + examples, tally, raw_tally, effective_samples = train_fct(self, corpus_file, offset, cython_vocab, + cur_epoch, total_examples, total_words, work, neu1, self.compute_loss) - return examples, tally, raw_tally + return examples, tally, raw_tally, effective_samples def _do_train_job(self, sentences, alpha, inits): """Train the model on a single batch of sentences. diff --git a/gensim/models/word2vec_corpusfile.pyx b/gensim/models/word2vec_corpusfile.pyx index 4861fbd923..31ded9d150 100644 --- a/gensim/models/word2vec_corpusfile.pyx +++ b/gensim/models/word2vec_corpusfile.pyx @@ -289,6 +289,7 @@ def train_epoch_sg(model, corpus_file, offset, _cython_vocab, _cur_epoch, _expec cdef int i, j, k cdef int effective_words = 0, effective_sentences = 0 + cdef int effective_samples = 0 cdef int total_effective_words = 0, total_sentences = 0, total_words = 0 cdef int sent_idx, idx_start, idx_end @@ -322,6 +323,7 @@ def train_epoch_sg(model, corpus_file, offset, _cython_vocab, _cur_epoch, _expec for j in range(j, k): if j == i: continue + effective_samples += 1 if c.hs: w2v_fast_sentence_sg_hs( c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], @@ -340,7 +342,7 @@ def train_epoch_sg(model, corpus_file, offset, _cython_vocab, _cur_epoch, _expec expected_examples, expected_words, cur_epoch, num_epochs) model.running_training_loss = c.running_training_loss - return total_sentences, total_effective_words, total_words + return total_sentences, total_effective_words, total_words, effective_samples def train_epoch_cbow(model, corpus_file, offset, _cython_vocab, _cur_epoch, _expected_examples, _expected_words, _work, @@ -435,7 +437,7 @@ def train_epoch_cbow(model, corpus_file, offset, _cython_vocab, _cur_epoch, _exp expected_examples, expected_words, cur_epoch, num_epochs) model.running_training_loss = c.running_training_loss - return total_sentences, total_effective_words, total_words + return total_sentences, total_effective_words, total_words, total_effective_words CORPUSFILE_VERSION = 1 From 6b46f6498a3b1200d3ee5a2a911137fea7ba2be7 Mon Sep 17 00:00:00 2001 From: akhlif Date: Fri, 18 Jan 2019 17:00:56 +0100 Subject: [PATCH 09/13] Fixing broken interface with doc2vec --- gensim/models/base_any2vec.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index cc73032af6..d836180033 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -184,10 +184,19 @@ def _worker_loop_corpusfile(self, corpus_file, thread_id, offset, cython_vocab, """ thread_private_mem = self._get_thread_working_mem() - examples, tally, raw_tally, effective_samples = self._do_train_epoch( + stats_tuple = self._do_train_epoch( corpus_file, thread_id, offset, cython_vocab, thread_private_mem, cur_epoch, total_examples=total_examples, total_words=total_words, **kwargs) + if len(stats_tuple) == 4: + examples, tally, raw_tally, effective_samples = stats_tuple + else: + # TODO: Some models haven't updated their _do_train_epoch method to return a 4-tuple instead of a + # 3-tuple, containing also the number of samples used while processing the batch. + # For those models that don't implement samples tallying, We assume that the number of samples is the + # effective words tally. This gives coherent outputs with previous implementations. + examples, tally, raw_tally = stats_tuple + effective_samples = tally progress_queue.put((examples, tally, raw_tally, effective_samples)) progress_queue.put(None) From f6a5cc536b0d1e63ef88d7727031afe5da90a3ca Mon Sep 17 00:00:00 2001 From: akhlif Date: Fri, 18 Jan 2019 17:33:17 +0100 Subject: [PATCH 10/13] Merging with develop base --- gensim/models/base_any2vec.py | 98 +- gensim/models/word2vec.py | 13 +- gensim/models/word2vec_inner.c | 4285 ++++++++++++++++++++++++- gensim/models/word2vec_inner.pyx | 13 +- gensim/scripts/word2vec_standalone.py | 7 +- 5 files changed, 4375 insertions(+), 41 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 48461b23e4..cb3d34e3cd 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -130,7 +130,17 @@ def _do_train_epoch(self, corpus_file, thread_id, offset, cython_vocab, thread_p raise NotImplementedError() def _do_train_job(self, data_iterable, job_parameters, thread_private_mem): - """Train a single batch. Return 2-tuple `(effective word count, total word count)`.""" + """Train a single batch. Return 3-tuple + `(effective word count, total word count, total samples used)`. + + The total samples used is the same as the effective word count when + using CBOW, but it can differ with Skip-Gram, since a random number of + positve examples are used for each effective word. + + Knowing the effective number of samples used allows us to compute the + average loss for an epoch. + + """ raise NotImplementedError() def _check_training_sanity(self, epochs=None, total_examples=None, total_words=None, **kwargs): @@ -170,11 +180,20 @@ def _worker_loop_corpusfile(self, corpus_file, thread_id, offset, cython_vocab, """ thread_private_mem = self._get_thread_working_mem() - examples, tally, raw_tally = self._do_train_epoch( + stats_tuple = self._do_train_epoch( corpus_file, thread_id, offset, cython_vocab, thread_private_mem, cur_epoch, total_examples=total_examples, total_words=total_words, **kwargs) - progress_queue.put((examples, tally, raw_tally)) + if len(stats_tuple) == 4: + examples, tally, raw_tally, effective_samples = stats_tuple + else: + # TODO: Some models haven't updated their _do_train_epoch method to return a 4-tuple instead of a + # 3-tuple, containing also the number of samples used while processing the batch. + # For those models that don't implement samples tallying, We assume that the number of samples is the + # effective words tally. This gives coherent outputs with previous implementations. + examples, tally, raw_tally = stats_tuple + effective_samples = tally + progress_queue.put((examples, tally, raw_tally, effective_samples)) progress_queue.put(None) def _worker_loop(self, job_queue, progress_queue): @@ -208,12 +227,23 @@ def _worker_loop(self, job_queue, progress_queue): for callback in self.callbacks: callback.on_batch_begin(self) - tally, raw_tally = self._do_train_job(data_iterable, job_parameters, thread_private_mem) + stats_tuple = self._do_train_job( + data_iterable, job_parameters, thread_private_mem) + if len(stats_tuple) == 3: + tally, raw_tally, effective_samples = stats_tuple + else: + # TODO: Some models haven't updated their _do_train_job method to return a 3-tuple instead of a + # 2-tuple, containing also the number of samples used while processing the batch. + # For those models that don't implement samples tallying, We assume that the number of samples is the + # effective words tally. This gives coherent outputs with previous implementations. + tally, raw_tally = stats_tuple + effective_samples = tally for callback in self.callbacks: callback.on_batch_end(self) - progress_queue.put((len(data_iterable), tally, raw_tally)) # report back progress + # report back progress + progress_queue.put((len(data_iterable), tally, raw_tally, effective_samples)) jobs_processed += 1 logger.debug("worker exiting, processed %i jobs", jobs_processed) @@ -289,7 +319,7 @@ def _job_producer(self, data_iterator, job_queue, cur_epoch=0, total_examples=No logger.debug("job loop exiting, total %i jobs", job_no) def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed): + raw_word_count, total_words, trained_word_count, total_samples, elapsed): raise NotImplementedError() def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, @@ -337,7 +367,7 @@ def _log_epoch_progress(self, progress_queue=None, job_queue=None, cur_epoch=0, * Total word count used in training. """ - example_count, trained_word_count, raw_word_count = 0, 0, 0 + example_count, trained_word_count, raw_word_count, samples_count = 0, 0, 0, 0 start, next_report = default_timer() - 0.00001, 1.0 job_tally = 0 unfinished_worker_count = self.workers @@ -348,20 +378,20 @@ def _log_epoch_progress(self, progress_queue=None, job_queue=None, cur_epoch=0, unfinished_worker_count -= 1 logger.info("worker thread finished; awaiting finish of %i more threads", unfinished_worker_count) continue - examples, trained_words, raw_words = report + examples, trained_words, raw_words, effective_samples = report job_tally += 1 # update progress stats example_count += examples trained_word_count += trained_words # only words in vocab & sampled raw_word_count += raw_words - + samples_count += effective_samples # log progress once every report_delay seconds elapsed = default_timer() - start if elapsed >= next_report: self._log_progress( job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed) + raw_word_count, total_words, trained_word_count, samples_count, elapsed) next_report = elapsed + report_delay # all done; report the final stats elapsed = default_timer() - start @@ -465,6 +495,7 @@ def _train_epoch(self, data_iterable, cur_epoch=0, total_examples=None, total_wo * Total word count used in training. """ + self.running_training_loss = 0. job_queue = Queue(maxsize=queue_factor * self.workers) progress_queue = Queue(maxsize=(queue_factor + 1) * self.workers) @@ -1080,6 +1111,10 @@ def train(self, sentences=None, corpus_file=None, total_examples=None, total_wor queue_factor=queue_factor, report_delay=report_delay, compute_loss=compute_loss, callbacks=callbacks, **kwargs) + def get_latest_training_loss(self): + raise NotImplementedError( + "To compute the loss for a model, you must implement get_latest_training_loss") + def _get_job_params(self, cur_epoch): """Get the learning rate used in the current epoch. @@ -1262,7 +1297,7 @@ def load(cls, *args, **kwargs): return model def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, total_examples, - raw_word_count, total_words, trained_word_count, elapsed): + raw_word_count, total_words, trained_word_count, total_samples, elapsed): """Callback used to log progress for long running jobs. Parameters @@ -1288,6 +1323,8 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot trained_word_count : int Number of effective words used in training until now (after ignoring unknown words and trimming the sentence length). + total_samples : int + Number of effective samples used in training until now (differs from total_examples for Skip-Gram) elapsed : int Elapsed time since the beginning of training in seconds. @@ -1297,20 +1334,39 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot always be equal to -1. """ + if self.compute_loss: + if total_samples == 0: + loss = -1 + else: + loss = self.get_latest_training_loss() / total_samples if total_examples: # examples-based progress % - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, - -1 if job_queue is None else utils.qsize(job_queue), utils.qsize(progress_queue) - ) + if self.compute_loss: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue), loss + ) + else: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i", + cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue) + ) else: # words-based progress % - logger.info( - "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i", - cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, - -1 if job_queue is None else utils.qsize(job_queue), utils.qsize(progress_queue) - ) + if self.compute_loss: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i", + cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue) + ) + else: + logger.info( + "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, + utils.qsize(job_queue), utils.qsize(progress_queue), loss + ) def _log_epoch_end(self, cur_epoch, example_count, total_examples, raw_word_count, total_words, trained_word_count, elapsed, is_corpus_file_mode): diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index dcd7471704..5e1703a130 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -194,6 +194,7 @@ def train_batch_sg(model, sentences, alpha, work=None, compute_loss=False): """ result = 0 + effective_samples = 0 for sentence in sentences: word_vocabs = [model.wv.vocab[w] for w in sentence if w in model.wv.vocab and model.wv.vocab[w].sample_int > model.random.rand() * 2 ** 32] @@ -205,12 +206,13 @@ def train_batch_sg(model, sentences, alpha, work=None, compute_loss=False): for pos2, word2 in enumerate(word_vocabs[start:(pos + model.window + 1 - reduced_window)], start): # don't train on the `word` itself if pos2 != pos: + effective_samples += 1 train_sg_pair( model, model.wv.index2word[word.index], word2.index, alpha, compute_loss=compute_loss ) result += len(word_vocabs) - return result + return result, effective_samples def train_batch_cbow(model, sentences, alpha, work=None, neu1=None, compute_loss=False): """Update CBOW model by training on a sequence of sentences. @@ -260,7 +262,7 @@ def train_batch_cbow(model, sentences, alpha, work=None, neu1=None, compute_loss l1 /= len(word2_indices) train_cbow_pair(model, word, word2_indices, l1, alpha, compute_loss=compute_loss) result += len(word_vocabs) - return result + return result, result def score_sentence_sg(model, sentence, work=None): """Obtain likelihood score for a single sentence in a fitted skip-gram representation. @@ -814,12 +816,11 @@ def _do_train_job(self, sentences, alpha, inits): """ work, neu1 = inits - tally = 0 if self.sg: - tally += train_batch_sg(self, sentences, alpha, work, self.compute_loss) + (tally, effective_samples) = train_batch_sg(self, sentences, alpha, work, self.compute_loss) else: - tally += train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) - return tally, self._raw_word_count(sentences) + (tally, effective_samples) = train_batch_cbow(self, sentences, alpha, work, neu1, self.compute_loss) + return tally, self._raw_word_count(sentences), effective_samples def _clear_post_train(self): """Remove all L2-normalized word vectors from the model.""" diff --git a/gensim/models/word2vec_inner.c b/gensim/models/word2vec_inner.c index 230a8fdd69..5546476d54 100644 --- a/gensim/models/word2vec_inner.c +++ b/gensim/models/word2vec_inner.c @@ -1,4 +1,26 @@ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* Generated by Cython 0.29.2 */ +======= +/* Generated by Cython 0.28.4 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "models/voidptr.h" + ], + "include_dirs": [ + "models" + ], + "name": "gensim.models.word2vec_inner", + "sources": [ + "/home/akhlif/dzr_core/gensim/gensim/models/word2vec_inner.pyx" + ] + }, + "module_name": "gensim.models.word2vec_inner" +} +END: Cython Metadata */ +>>>>>>> Fixing the computation of the Word2Vec loss. #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,8 +29,12 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #define CYTHON_ABI "0_29_2" #define CYTHON_HEX_VERSION 0x001D02F0 +======= +#define CYTHON_ABI "0_28_4" +>>>>>>> Fixing the computation of the Word2Vec loss. #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -297,6 +323,105 @@ #define CYTHON_INLINE #endif #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +>>>>>>> Fixing the computation of the Word2Vec loss. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 @@ -326,9 +451,12 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif +======= +>>>>>>> Fixing the computation of the Word2Vec loss. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 @@ -346,6 +474,7 @@ #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_USE_DICT_VERSIONS #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ @@ -366,16 +495,21 @@ #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif +======= +>>>>>>> Fixing the computation of the Word2Vec loss. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 #define PyMem_RawMalloc(n) PyMem_Malloc(n) #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) #define PyMem_RawFree(p) PyMem_Free(p) #endif +======= +>>>>>>> Fixing the computation of the Word2Vec loss. #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) @@ -483,8 +617,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +======= +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +>>>>>>> Fixing the computation of the Word2Vec loss. #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else @@ -608,6 +747,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__gensim__models__word2vec_inner #define __PYX_HAVE_API__gensim__models__word2vec_inner /* Early includes */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= +#include "voidptr.h" +>>>>>>> Fixing the computation of the Word2Vec loss. #include #include #include "numpy/arrayobject.h" @@ -843,7 +986,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "gensim/models/word2vec_inner.pyx", + "models/word2vec_inner.pyx", "__init__.pxd", "type.pxd", }; @@ -860,7 +1003,11 @@ static const char *__pyx_f[] = { #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":730 +>>>>>>> Fixing the computation of the Word2Vec loss. * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -869,7 +1016,11 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":731 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -878,7 +1029,11 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -887,7 +1042,11 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -896,7 +1055,11 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":737 +>>>>>>> Fixing the computation of the Word2Vec loss. * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -905,7 +1068,11 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":738 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -914,7 +1081,11 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -923,7 +1094,11 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":786 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -932,7 +1107,11 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":744 +>>>>>>> Fixing the computation of the Word2Vec loss. * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -941,7 +1120,11 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":745 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -950,7 +1133,11 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":800 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754 +>>>>>>> Fixing the computation of the Word2Vec loss. * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -959,7 +1146,11 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755 +>>>>>>> Fixing the computation of the Word2Vec loss. * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -968,7 +1159,11 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":756 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -977,7 +1172,11 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":804 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -986,7 +1185,11 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":759 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -995,7 +1198,11 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -1004,7 +1211,11 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":808 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1013,7 +1224,11 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":763 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1022,7 +1237,11 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":811 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1031,7 +1250,11 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1040,7 +1263,11 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":767 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1084,7 +1311,11 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do /*--- Type declarations ---*/ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":769 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1093,7 +1324,11 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770 +>>>>>>> Fixing the computation of the Word2Vec loss. * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1102,7 +1337,11 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":817 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1111,7 +1350,11 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":819 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1529,6 +1772,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* GetModuleGlobalName.proto */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) {\ static PY_UINT64_T __pyx_dict_version = 0;\ @@ -1548,6 +1792,9 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif +======= +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); +>>>>>>> Fixing the computation of the Word2Vec loss. /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON @@ -1885,6 +2132,7 @@ static const char __pyx_k_vectors_lockf[] = "vectors_lockf"; static const char __pyx_k_train_batch_sg[] = "train_batch_sg"; static const char __pyx_k_effective_words[] = "effective_words"; static const char __pyx_k_train_batch_cbow[] = "train_batch_cbow"; +static const char __pyx_k_effective_samples[] = "effective_samples"; static const char __pyx_k_scipy_linalg_blas[] = "scipy.linalg.blas"; static const char __pyx_k_score_sentence_sg[] = "score_sentence_sg"; static const char __pyx_k_MAX_WORDS_IN_BATCH[] = "MAX_WORDS_IN_BATCH"; @@ -1892,14 +2140,23 @@ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_effective_sentences[] = "effective_sentences"; static const char __pyx_k_score_sentence_cbow[] = "score_sentence_cbow"; static const char __pyx_k_running_training_loss[] = "running_training_loss"; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= +static const char __pyx_k_running_training_loss_2[] = "_running_training_loss"; +static const char __pyx_k_models_word2vec_inner_pyx[] = "models/word2vec_inner.pyx"; +>>>>>>> Fixing the computation of the Word2Vec loss. static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_gensim_models_word2vec_inner[] = "gensim.models.word2vec_inner"; +static const char __pyx_k_running_training_loss_sample[] = "_running_training_loss_sample"; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static const char __pyx_k_Optimized_cython_functions_for_t[] = "Optimized cython functions for training :class:`~gensim.models.word2vec.Word2Vec` model."; static const char __pyx_k_gensim_models_word2vec_inner_pyx[] = "gensim/models/word2vec_inner.pyx"; +======= +>>>>>>> Fixing the computation of the Word2Vec loss. static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import"; static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; @@ -1924,6 +2181,7 @@ static PyObject *__pyx_n_s_cpointer; static PyObject *__pyx_n_s_cum_table; static PyObject *__pyx_n_s_d_res; static PyObject *__pyx_n_s_dsdot; +static PyObject *__pyx_n_s_effective_samples; static PyObject *__pyx_n_s_effective_sentences; static PyObject *__pyx_n_s_effective_words; static PyObject *__pyx_n_s_enumerate; @@ -1931,7 +2189,6 @@ static PyObject *__pyx_n_s_expected; static PyObject *__pyx_n_s_fblas; static PyObject *__pyx_n_s_float32; static PyObject *__pyx_n_s_gensim_models_word2vec_inner; -static PyObject *__pyx_kp_s_gensim_models_word2vec_inner_pyx; static PyObject *__pyx_n_s_hs; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_idx_end; @@ -1944,7 +2201,11 @@ static PyObject *__pyx_n_s_j; static PyObject *__pyx_n_s_k; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_model; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static PyObject *__pyx_n_s_name; +======= +static PyObject *__pyx_kp_s_models_word2vec_inner_pyx; +>>>>>>> Fixing the computation of the Word2Vec loss. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_negative; @@ -1963,6 +2224,11 @@ static PyObject *__pyx_n_s_random; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_result; static PyObject *__pyx_n_s_running_training_loss; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= +static PyObject *__pyx_n_s_running_training_loss_2; +static PyObject *__pyx_n_s_running_training_loss_sample; +>>>>>>> Fixing the computation of the Word2Vec loss. static PyObject *__pyx_n_s_sample; static PyObject *__pyx_n_s_sample_int; static PyObject *__pyx_n_s_saxpy; @@ -2022,6 +2288,7 @@ static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__12; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static PyObject *__pyx_tuple__14; static PyObject *__pyx_tuple__16; static PyObject *__pyx_tuple__18; @@ -2033,6 +2300,22 @@ static PyObject *__pyx_codeobj__19; /* Late includes */ /* "gensim/models/word2vec_inner.pyx":51 +======= +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__21; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_codeobj__16; +static PyObject *__pyx_codeobj__18; +static PyObject *__pyx_codeobj__20; +static PyObject *__pyx_codeobj__22; +static PyObject *__pyx_codeobj__24; +/* Late includes */ + +/* "gensim/models/word2vec_inner.pyx":46 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # for when fblas.sdot returns a double * cdef REAL_t our_dot_double(const int *N, const float *X, const int *incX, const float *Y, const int *incY) nogil: # <<<<<<<<<<<<<< @@ -4059,8 +4342,144 @@ static unsigned PY_LONG_LONG __pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_s * c[0].negative = model.negative */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct __pyx_t_6gensim_6models_14word2vec_inner_Word2VecConfig *__pyx_v_c, PyObject *__pyx_v_model, PyObject *__pyx_v_alpha, PyObject *__pyx_v_compute_loss, PyObject *__pyx_v__work, struct __pyx_opt_args_6gensim_6models_14word2vec_inner_init_w2v_config *__pyx_optional_args) { PyObject *__pyx_v__neu1 = ((PyObject *)Py_None); +======= +/* Python wrapper */ +static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_1train_batch_sg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_6gensim_6models_14word2vec_inner_1train_batch_sg = {"train_batch_sg", (PyCFunction)__pyx_pw_6gensim_6models_14word2vec_inner_1train_batch_sg, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_1train_batch_sg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_model = 0; + PyObject *__pyx_v_sentences = 0; + PyObject *__pyx_v_alpha = 0; + PyObject *__pyx_v__work = 0; + PyObject *__pyx_v_compute_loss = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("train_batch_sg (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_model,&__pyx_n_s_sentences,&__pyx_n_s_alpha,&__pyx_n_s_work,&__pyx_n_s_compute_loss,0}; + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_model)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 1); __PYX_ERR(0, 296, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 2); __PYX_ERR(0, 296, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 3); __PYX_ERR(0, 296, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, 4); __PYX_ERR(0, 296, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_batch_sg") < 0)) __PYX_ERR(0, 296, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + } + __pyx_v_model = values[0]; + __pyx_v_sentences = values[1]; + __pyx_v_alpha = values[2]; + __pyx_v__work = values[3]; + __pyx_v_compute_loss = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("train_batch_sg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 296, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("gensim.models.word2vec_inner.train_batch_sg", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(__pyx_self, __pyx_v_model, __pyx_v_sentences, __pyx_v_alpha, __pyx_v__work, __pyx_v_compute_loss); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_model, PyObject *__pyx_v_sentences, PyObject *__pyx_v_alpha, PyObject *__pyx_v__work, PyObject *__pyx_v_compute_loss) { + int __pyx_v_hs; + int __pyx_v_negative; + int __pyx_v_sample; + int __pyx_v__compute_loss; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_v__running_training_loss; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *__pyx_v_syn0; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *__pyx_v_word_locks; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *__pyx_v_work; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t __pyx_v__alpha; + int __pyx_v_size; + int __pyx_v_codelens[0x2710]; + __pyx_t_5numpy_uint32_t __pyx_v_indexes[0x2710]; + __pyx_t_5numpy_uint32_t __pyx_v_reduced_windows[0x2710]; + int __pyx_v_sentence_idx[(0x2710 + 1)]; + int __pyx_v_window; + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_k; + int __pyx_v_effective_words; + int __pyx_v_effective_sentences; + int __pyx_v_effective_samples; + int __pyx_v_sent_idx; + int __pyx_v_idx_start; + int __pyx_v_idx_end; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *__pyx_v_syn1; + __pyx_t_5numpy_uint32_t *__pyx_v_points[0x2710]; + __pyx_t_5numpy_uint8_t *__pyx_v_codes[0x2710]; + __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *__pyx_v_syn1neg; + __pyx_t_5numpy_uint32_t *__pyx_v_cum_table; + unsigned PY_LONG_LONG __pyx_v_cum_table_len; + unsigned PY_LONG_LONG __pyx_v_next_random; + PyObject *__pyx_v_vlookup = NULL; + PyObject *__pyx_v_sent = NULL; + PyObject *__pyx_v_token = NULL; + PyObject *__pyx_v_word = NULL; + PyObject *__pyx_v_item = NULL; + CYTHON_UNUSED long __pyx_v__running_training_loss_sample; +>>>>>>> Fixing the computation of the Word2Vec loss. PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4072,12 +4491,32 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct int __pyx_t_7; PyObject *__pyx_t_8 = NULL; unsigned PY_LONG_LONG __pyx_t_9; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RefNannySetupContext("init_w2v_config", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v__neu1 = __pyx_optional_args->_neu1; } } +======= + PyObject *(*__pyx_t_10)(PyObject *); + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + __pyx_t_5numpy_uint32_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + int __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + __Pyx_RefNannySetupContext("train_batch_sg", 0); +>>>>>>> Fixing the computation of the Word2Vec loss. /* "gensim/models/word2vec_inner.pyx":468 * @@ -4105,12 +4544,21 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (__pyx_v_c[0]).negative = __pyx_t_2; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":470 * c[0].hs = model.hs * c[0].negative = model.negative * c[0].sample = (model.vocabulary.sample != 0) # <<<<<<<<<<<<<< * c[0].cbow_mean = model.cbow_mean * c[0].window = model.window +======= + /* "gensim/models/word2vec_inner.pyx":299 + * cdef int hs = model.hs + * cdef int negative = model.negative + * cdef int sample = (model.vocabulary.sample != 0) # <<<<<<<<<<<<<< + * + * cdef int _compute_loss = (1 if compute_loss is True else 0) +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -4143,6 +4591,7 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct * c[0].window = model.window # <<<<<<<<<<<<<< * c[0].workers = model.workers * +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -4154,9 +4603,14 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct * c[0].cbow_mean = model.cbow_mean * c[0].window = model.window * c[0].workers = model.workers # <<<<<<<<<<<<<< +======= + * cdef int _compute_loss = (1 if compute_loss is True else 0) # <<<<<<<<<<<<<< + * cdef REAL_t _running_training_loss = 0 +>>>>>>> Fixing the computation of the Word2Vec loss. * * c[0].compute_loss = (1 if compute_loss else 0) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_workers); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 473, __pyx_L1_error) @@ -4172,6 +4626,10 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct */ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_compute_loss); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 475, __pyx_L1_error) if (__pyx_t_4) { +======= + __pyx_t_4 = (__pyx_v_compute_loss == Py_True); + if ((__pyx_t_4 != 0)) { +>>>>>>> Fixing the computation of the Word2Vec loss. __pyx_t_2 = 1; } else { __pyx_t_2 = 0; @@ -4180,11 +4638,17 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct /* "gensim/models/word2vec_inner.pyx":476 * +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 * c[0].compute_loss = (1 if compute_loss else 0) * c[0].running_training_loss = model.running_training_loss # <<<<<<<<<<<<<< +======= + * cdef int _compute_loss = (1 if compute_loss is True else 0) + * cdef REAL_t _running_training_loss = 0 # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * * c[0].syn0 = (np.PyArray_DATA(model.wv.vectors)) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error) @@ -4193,6 +4657,12 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct /* "gensim/models/word2vec_inner.pyx":478 * c[0].running_training_loss = model.running_training_loss +======= + __pyx_v__running_training_loss = 0.0; + + /* "gensim/models/word2vec_inner.pyx":304 + * cdef REAL_t _running_training_loss = 0 +>>>>>>> Fixing the computation of the Word2Vec loss. * * c[0].syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * c[0].word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) @@ -4252,11 +4722,41 @@ static PyObject *__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config(struct /* "gensim/models/word2vec_inner.pyx":483 * c[0].size = model.wv.vector_size * +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 * if c[0].hs: # <<<<<<<<<<<<<< * c[0].syn1 = (np.PyArray_DATA(model.trainables.syn1)) * */ __pyx_t_4 = ((__pyx_v_c[0]).hs != 0); +======= + * cdef int i, j, k + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_window = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":317 + * + * cdef int i, j, k + * cdef int effective_words = 0, effective_sentences = 0, effective_samples = 0 # <<<<<<<<<<<<<< + * cdef int sent_idx, idx_start, idx_end + * + */ + __pyx_v_effective_words = 0; + __pyx_v_effective_sentences = 0; + __pyx_v_effective_samples = 0; + + /* "gensim/models/word2vec_inner.pyx":332 + * cdef unsigned long long next_random + * + * if hs: # <<<<<<<<<<<<<< + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) + * + */ + __pyx_t_4 = (__pyx_v_hs != 0); +>>>>>>> Fixing the computation of the Word2Vec loss. if (__pyx_t_4) { /* "gensim/models/word2vec_inner.pyx":484 @@ -4800,12 +5300,21 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 540, __pyx_L1_error) if ((__pyx_t_6 != 0)) { __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __pyx_t_10; __pyx_t_10 = 0; +======= + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 352, __pyx_L1_error) + if ((__pyx_t_7 != 0)) { + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __pyx_t_13; + __pyx_t_13 = 0; +>>>>>>> Fixing the computation of the Word2Vec loss. } else { __Pyx_INCREF(Py_None); __pyx_t_9 = Py_None; @@ -5220,10 +5729,17 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * idx_start = c.sentence_idx[sent_idx] * idx_end = c.sentence_idx[sent_idx + 1] */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_14 = __pyx_v_effective_sentences; __pyx_t_15 = __pyx_t_14; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_15; __pyx_t_17+=1) { __pyx_v_sent_idx = __pyx_t_17; +======= + __pyx_t_2 = __pyx_v_effective_sentences; + __pyx_t_17 = __pyx_t_2; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) { + __pyx_v_sent_idx = __pyx_t_19; +>>>>>>> Fixing the computation of the Word2Vec loss. /* "gensim/models/word2vec_inner.pyx":570 * with nogil: @@ -5250,10 +5766,17 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * j = i - c.window + c.reduced_windows[i] * if j < idx_start: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_18 = __pyx_v_idx_end; __pyx_t_19 = __pyx_t_18; for (__pyx_t_20 = __pyx_v_idx_start; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { __pyx_v_i = __pyx_t_20; +======= + __pyx_t_20 = __pyx_v_idx_end; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = __pyx_v_idx_start; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_i = __pyx_t_22; +>>>>>>> Fixing the computation of the Word2Vec loss. /* "gensim/models/word2vec_inner.pyx":573 * idx_end = c.sentence_idx[sent_idx + 1] @@ -5306,7 +5829,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + c.window + 1 - c.reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< * k = idx_end - * for j in range(j, k): + * _running_training_loss_sample = 0 */ __pyx_t_5 = ((__pyx_v_k > __pyx_v_idx_end) != 0); if (__pyx_t_5) { @@ -5315,8 +5838,8 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + c.window + 1 - c.reduced_windows[i] * if k > idx_end: * k = idx_end # <<<<<<<<<<<<<< + * _running_training_loss_sample = 0 * for j in range(j, k): - * if j == i: */ __pyx_v_k = __pyx_v_idx_end; @@ -5325,17 +5848,27 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * k = i + c.window + 1 - c.reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< * k = idx_end - * for j in range(j, k): + * _running_training_loss_sample = 0 */ } /* "gensim/models/word2vec_inner.pyx":579 * if k > idx_end: * k = idx_end + * _running_training_loss_sample = 0 # <<<<<<<<<<<<<< + * for j in range(j, k): + * if j == i: + */ + __pyx_v__running_training_loss_sample = 0; + + /* "gensim/models/word2vec_inner.pyx":392 + * k = idx_end + * _running_training_loss_sample = 0 * for j in range(j, k): # <<<<<<<<<<<<<< * if j == i: * continue */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_21 = __pyx_v_k; __pyx_t_22 = __pyx_t_21; for (__pyx_t_23 = __pyx_v_j; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) { @@ -5347,19 +5880,42 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * if j == i: # <<<<<<<<<<<<<< * continue * if c.hs: +======= + __pyx_t_23 = __pyx_v_k; + __pyx_t_24 = __pyx_t_23; + for (__pyx_t_25 = __pyx_v_j; __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) { + __pyx_v_j = __pyx_t_25; + + /* "gensim/models/word2vec_inner.pyx":393 + * _running_training_loss_sample = 0 + * for j in range(j, k): + * if j == i: # <<<<<<<<<<<<<< + * continue + * effective_samples += 1 +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_t_5 = ((__pyx_v_j == __pyx_v_i) != 0); if (__pyx_t_5) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":581 * for j in range(j, k): * if j == i: * continue # <<<<<<<<<<<<<< * if c.hs: * w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) +======= + /* "gensim/models/word2vec_inner.pyx":394 + * for j in range(j, k): + * if j == i: + * continue # <<<<<<<<<<<<<< + * effective_samples += 1 + * if hs: +>>>>>>> Fixing the computation of the Word2Vec loss. */ goto __pyx_L26_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":580 * k = idx_end * for j in range(j, k): @@ -5375,19 +5931,55 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * if c.hs: # <<<<<<<<<<<<<< * w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: +======= + /* "gensim/models/word2vec_inner.pyx":393 + * _running_training_loss_sample = 0 + * for j in range(j, k): + * if j == i: # <<<<<<<<<<<<<< + * continue + * effective_samples += 1 + */ + } + + /* "gensim/models/word2vec_inner.pyx":395 + * if j == i: + * continue + * effective_samples += 1 # <<<<<<<<<<<<<< + * if hs: + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + */ + __pyx_v_effective_samples = (__pyx_v_effective_samples + 1); + + /* "gensim/models/word2vec_inner.pyx":396 + * continue + * effective_samples += 1 + * if hs: # <<<<<<<<<<<<<< + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + * if negative: +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_t_5 = (__pyx_v_c.hs != 0); if (__pyx_t_5) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":583 * continue * if c.hs: * w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) # <<<<<<<<<<<<<< * if c.negative: * c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) +======= + /* "gensim/models/word2vec_inner.pyx":397 + * effective_samples += 1 + * if hs: + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< + * if negative: + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_sg_hs((__pyx_v_c.points[__pyx_v_i]), (__pyx_v_c.codes[__pyx_v_i]), (__pyx_v_c.codelens[__pyx_v_i]), __pyx_v_c.syn0, __pyx_v_c.syn1, __pyx_v_c.size, (__pyx_v_c.indexes[__pyx_v_j]), __pyx_v_c.alpha, __pyx_v_c.work, __pyx_v_c.word_locks, __pyx_v_c.compute_loss, (&__pyx_v_c.running_training_loss)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":582 * if j == i: * continue @@ -5403,25 +5995,60 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * if c.negative: # <<<<<<<<<<<<<< * c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) * +======= + /* "gensim/models/word2vec_inner.pyx":396 + * continue + * effective_samples += 1 + * if hs: # <<<<<<<<<<<<<< + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + * if negative: + */ + } + + /* "gensim/models/word2vec_inner.pyx":398 + * if hs: + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + * if negative: # <<<<<<<<<<<<<< + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) + * model.running_training_loss += _running_training_loss +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_t_5 = (__pyx_v_c.negative != 0); if (__pyx_t_5) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":585 * w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: * c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) # <<<<<<<<<<<<<< * * model.running_training_loss = c.running_training_loss +======= + /* "gensim/models/word2vec_inner.pyx":399 + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + * if negative: + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< + * model.running_training_loss += _running_training_loss + * return effective_words, effective_samples +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_v_c.next_random = __pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_sg_neg(__pyx_v_c.negative, __pyx_v_c.cum_table, __pyx_v_c.cum_table_len, __pyx_v_c.syn0, __pyx_v_c.syn1neg, __pyx_v_c.size, (__pyx_v_c.indexes[__pyx_v_i]), (__pyx_v_c.indexes[__pyx_v_j]), __pyx_v_c.alpha, __pyx_v_c.work, __pyx_v_c.next_random, __pyx_v_c.word_locks, __pyx_v_c.compute_loss, (&__pyx_v_c.running_training_loss)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":584 * if c.hs: * w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: # <<<<<<<<<<<<<< * c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) * +======= + /* "gensim/models/word2vec_inner.pyx":398 + * if hs: + * fast_sentence_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], _alpha, work, word_locks, _compute_loss, &_running_training_loss) + * if negative: # <<<<<<<<<<<<<< + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) + * model.running_training_loss += _running_training_loss +>>>>>>> Fixing the computation of the Word2Vec loss. */ } __pyx_L26_continue:; @@ -5449,6 +6076,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":587 * c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) * @@ -5465,14 +6093,55 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON * * model.running_training_loss = c.running_training_loss * return effective_words # <<<<<<<<<<<<<< +======= + /* "gensim/models/word2vec_inner.pyx":400 + * if negative: + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) + * model.running_training_loss += _running_training_loss # <<<<<<<<<<<<<< + * return effective_words, effective_samples + * + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_18) < 0) __PYX_ERR(0, 400, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "gensim/models/word2vec_inner.pyx":401 + * next_random = fast_sentence_sg_neg(negative, cum_table, cum_table_len, syn0, syn1neg, size, indexes[i], indexes[j], _alpha, work, next_random, word_locks, _compute_loss, &_running_training_loss) + * model.running_training_loss += _running_training_loss + * return effective_words, effective_samples # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * * */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_r = __pyx_t_11; __pyx_t_11 = 0; +======= + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_effective_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __pyx_t_18 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; +>>>>>>> Fixing the computation of the Word2Vec loss. goto __pyx_L0; /* "gensim/models/word2vec_inner.pyx":500 @@ -5504,7 +6173,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_train_batch_sg(CYTHON return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":591 +======= +/* "gensim/models/word2vec_inner.pyx":404 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< @@ -5557,35 +6230,59 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_3train_batch_cbow(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentences)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 1); __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 1); __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 2); __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 2); __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 3); __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 3); __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 4); __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 4); __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compute_loss)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 5); __PYX_ERR(0, 591, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_batch_cbow") < 0)) __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, 5); __PYX_ERR(0, 404, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_batch_cbow") < 0)) __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -5606,7 +6303,11 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_3train_batch_cbow(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 591, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("train_batch_cbow", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 404, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.train_batch_cbow", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5657,10 +6358,170 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT int __pyx_t_19; int __pyx_t_20; int __pyx_t_21; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RefNannySetupContext("train_batch_cbow", 0); /* "gensim/models/word2vec_inner.pyx":619 * cdef Word2VecConfig c +======= + int __pyx_t_22; + __Pyx_RefNannySetupContext("train_batch_cbow", 0); + + /* "gensim/models/word2vec_inner.pyx":405 + * + * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): + * cdef int hs = model.hs # <<<<<<<<<<<<<< + * cdef int negative = model.negative + * cdef int sample = (model.vocabulary.sample != 0) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_hs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 405, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_hs = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":406 + * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): + * cdef int hs = model.hs + * cdef int negative = model.negative # <<<<<<<<<<<<<< + * cdef int sample = (model.vocabulary.sample != 0) + * cdef int cbow_mean = model.cbow_mean + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_negative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_negative = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":407 + * cdef int hs = model.hs + * cdef int negative = model.negative + * cdef int sample = (model.vocabulary.sample != 0) # <<<<<<<<<<<<<< + * cdef int cbow_mean = model.cbow_mean + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_sample = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":408 + * cdef int negative = model.negative + * cdef int sample = (model.vocabulary.sample != 0) + * cdef int cbow_mean = model.cbow_mean # <<<<<<<<<<<<<< + * + * cdef int _compute_loss = (1 if compute_loss is True else 0) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 408, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_cbow_mean = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":410 + * cdef int cbow_mean = model.cbow_mean + * + * cdef int _compute_loss = (1 if compute_loss is True else 0) # <<<<<<<<<<<<<< + * cdef REAL_t _running_training_loss = 0 + * + */ + __pyx_t_4 = (__pyx_v_compute_loss == Py_True); + if ((__pyx_t_4 != 0)) { + __pyx_t_2 = 1; + } else { + __pyx_t_2 = 0; + } + __pyx_v__compute_loss = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":411 + * + * cdef int _compute_loss = (1 if compute_loss is True else 0) + * cdef REAL_t _running_training_loss = 0 # <<<<<<<<<<<<<< + * + * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) + */ + __pyx_v__running_training_loss = 0.0; + + /* "gensim/models/word2vec_inner.pyx":413 + * cdef REAL_t _running_training_loss = 0 + * + * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< + * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) + * cdef REAL_t *work + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 413, __pyx_L1_error) + __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":414 + * + * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) + * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) # <<<<<<<<<<<<<< + * cdef REAL_t *work + * cdef REAL_t _alpha = alpha + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vectors_lockf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_v_word_locks = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":416 + * cdef REAL_t *word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) + * cdef REAL_t *work + * cdef REAL_t _alpha = alpha # <<<<<<<<<<<<<< + * cdef int size = model.wv.vector_size + * + */ + __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_alpha); if (unlikely((__pyx_t_5 == ((npy_float32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_v__alpha = __pyx_t_5; + + /* "gensim/models/word2vec_inner.pyx":417 + * cdef REAL_t *work + * cdef REAL_t _alpha = alpha + * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< + * + * cdef int codelens[MAX_SENTENCE_LEN] + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_size = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":423 + * cdef np.uint32_t reduced_windows[MAX_SENTENCE_LEN] + * cdef int sentence_idx[MAX_SENTENCE_LEN + 1] + * cdef int window = model.window # <<<<<<<<<<<<<< + * + * cdef int i, j, k + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_window = __pyx_t_2; + + /* "gensim/models/word2vec_inner.pyx":426 + * +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int i, j, k * cdef int effective_words = 0, effective_sentences = 0 # <<<<<<<<<<<<<< * cdef int sent_idx, idx_start, idx_end @@ -5669,6 +6530,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_v_effective_words = 0; __pyx_v_effective_sentences = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":622 * cdef int sent_idx, idx_start, idx_end * @@ -5683,21 +6545,217 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "gensim/models/word2vec_inner.pyx":625 +======= + /* "gensim/models/word2vec_inner.pyx":441 + * cdef unsigned long long next_random + * + * if hs: # <<<<<<<<<<<<<< + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) + * + */ + __pyx_t_4 = (__pyx_v_hs != 0); + if (__pyx_t_4) { + + /* "gensim/models/word2vec_inner.pyx":442 + * + * if hs: + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< + * + * if negative: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_syn1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 442, __pyx_L1_error) + __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":441 + * cdef unsigned long long next_random + * + * if hs: # <<<<<<<<<<<<<< + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) + * + */ + } + + /* "gensim/models/word2vec_inner.pyx":444 + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) + * + * if negative: # <<<<<<<<<<<<<< + * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + */ + __pyx_t_4 = (__pyx_v_negative != 0); + if (__pyx_t_4) { + + /* "gensim/models/word2vec_inner.pyx":445 + * + * if negative: + * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) # <<<<<<<<<<<<<< + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + * cum_table_len = len(model.vocabulary.cum_table) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1neg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_v_syn1neg = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":446 + * if negative: + * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) # <<<<<<<<<<<<<< + * cum_table_len = len(model.vocabulary.cum_table) + * if negative or sample: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_v_cum_table = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":447 + * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + * cum_table_len = len(model.vocabulary.cum_table) # <<<<<<<<<<<<<< + * if negative or sample: + * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_vocabulary); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cum_table); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 447, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_cum_table_len = __pyx_t_6; + + /* "gensim/models/word2vec_inner.pyx":444 + * syn1 = (np.PyArray_DATA(model.trainables.syn1)) + * + * if negative: # <<<<<<<<<<<<<< + * syn1neg = (np.PyArray_DATA(model.trainables.syn1neg)) + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + */ + } + + /* "gensim/models/word2vec_inner.pyx":448 + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + * cum_table_len = len(model.vocabulary.cum_table) + * if negative or sample: # <<<<<<<<<<<<<< + * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) + * + */ + __pyx_t_7 = (__pyx_v_negative != 0); + if (!__pyx_t_7) { + } else { + __pyx_t_4 = __pyx_t_7; + goto __pyx_L6_bool_binop_done; + } + __pyx_t_7 = (__pyx_v_sample != 0); + __pyx_t_4 = __pyx_t_7; + __pyx_L6_bool_binop_done:; + if (__pyx_t_4) { + + /* "gensim/models/word2vec_inner.pyx":449 + * cum_table_len = len(model.vocabulary.cum_table) + * if negative or sample: + * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) # <<<<<<<<<<<<<< + * + * # convert Python structures to primitive types, so we can release the GIL + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_int_16777216, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_randint); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_8); if (unlikely((__pyx_t_9 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_next_random = __pyx_t_9; + + /* "gensim/models/word2vec_inner.pyx":448 + * cum_table = (np.PyArray_DATA(model.vocabulary.cum_table)) + * cum_table_len = len(model.vocabulary.cum_table) + * if negative or sample: # <<<<<<<<<<<<<< + * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) + * + */ + } + + /* "gensim/models/word2vec_inner.pyx":452 + * + * # convert Python structures to primitive types, so we can release the GIL + * work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< + * neu1 = np.PyArray_DATA(_neu1) + * + */ + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); + + /* "gensim/models/word2vec_inner.pyx":453 + * # convert Python structures to primitive types, so we can release the GIL + * work = np.PyArray_DATA(_work) + * neu1 = np.PyArray_DATA(_neu1) # <<<<<<<<<<<<<< + * + * # prepare C structures so we can go "full C" and release the Python GIL + */ + if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 453, __pyx_L1_error) + __pyx_v_neu1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__neu1))); + + /* "gensim/models/word2vec_inner.pyx":456 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # prepare C structures so we can go "full C" and release the Python GIL * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vocab); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error) +======= + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_vocab); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_vlookup = __pyx_t_3; __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":626 +======= + /* "gensim/models/word2vec_inner.pyx":457 +>>>>>>> Fixing the computation of the Word2Vec loss. * # prepare C structures so we can go "full C" and release the Python GIL * vlookup = model.wv.vocab * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 # <<<<<<<<<<<<<< @@ -5706,7 +6764,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ (__pyx_v_c.sentence_idx[0]) = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":627 +======= + /* "gensim/models/word2vec_inner.pyx":458 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: # <<<<<<<<<<<<<< @@ -5717,27 +6779,47 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_3 = __pyx_v_sentences; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_sentences); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 627, __pyx_L1_error) +======= + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_sentences); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 458, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 627, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); +======= + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); +>>>>>>> Fixing the computation of the Word2Vec loss. #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 627, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); +======= + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 458, __pyx_L1_error) + #else + __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); +>>>>>>> Fixing the computation of the Word2Vec loss. #endif } } else { @@ -5746,7 +6828,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 else __PYX_ERR(0, 627, __pyx_L1_error) +======= + else __PYX_ERR(0, 458, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } break; } @@ -5755,18 +6841,31 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_sent, __pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":628 * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 +======= + /* "gensim/models/word2vec_inner.pyx":459 + * sentence_idx[0] = 0 # indices of the first sentence always start at 0 +>>>>>>> Fixing the computation of the Word2Vec loss. * for sent in sentences: * if not sent: # <<<<<<<<<<<<<< * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_sent); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 628, __pyx_L1_error) __pyx_t_7 = ((!__pyx_t_6) != 0); if (__pyx_t_7) { /* "gensim/models/word2vec_inner.pyx":629 +======= + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_sent); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 459, __pyx_L1_error) + __pyx_t_7 = ((!__pyx_t_4) != 0); + if (__pyx_t_7) { + + /* "gensim/models/word2vec_inner.pyx":460 +>>>>>>> Fixing the computation of the Word2Vec loss. * for sent in sentences: * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged # <<<<<<<<<<<<<< @@ -5775,8 +6874,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L3_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":628 * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 +======= + /* "gensim/models/word2vec_inner.pyx":459 + * sentence_idx[0] = 0 # indices of the first sentence always start at 0 +>>>>>>> Fixing the computation of the Word2Vec loss. * for sent in sentences: * if not sent: # <<<<<<<<<<<<<< * continue # ignore empty sentences; leave effective_sentences unchanged @@ -5784,7 +6888,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":630 +======= + /* "gensim/models/word2vec_inner.pyx":461 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: # <<<<<<<<<<<<<< @@ -5795,27 +6903,47 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_1 = __pyx_v_sent; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; __pyx_t_9 = NULL; } else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error) +======= + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_sent); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 461, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } for (;;) { if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 630, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); +======= + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); +>>>>>>> Fixing the computation of the Word2Vec loss. #endif } else { if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_10); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 630, __pyx_L1_error) #else __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); +======= + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 461, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); +>>>>>>> Fixing the computation of the Word2Vec loss. #endif } } else { @@ -5824,7 +6952,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 else __PYX_ERR(0, 630, __pyx_L1_error) +======= + else __PYX_ERR(0, 461, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } break; } @@ -5833,19 +6965,32 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_10); __pyx_t_10 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":631 +======= + /* "gensim/models/word2vec_inner.pyx":462 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 631, __pyx_L1_error) if ((__pyx_t_7 != 0)) { __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_10 = __pyx_t_11; __pyx_t_11 = 0; +======= + __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 462, __pyx_L1_error) + if ((__pyx_t_7 != 0)) { + __pyx_t_13 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __pyx_t_13; + __pyx_t_13 = 0; +>>>>>>> Fixing the computation of the Word2Vec loss. } else { __Pyx_INCREF(Py_None); __pyx_t_10 = Py_None; @@ -5853,7 +6998,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_10); __pyx_t_10 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":632 +======= + /* "gensim/models/word2vec_inner.pyx":463 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sent: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -5864,7 +7013,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = (__pyx_t_7 != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":633 +======= + /* "gensim/models/word2vec_inner.pyx":464 +>>>>>>> Fixing the computation of the Word2Vec loss. * word = vlookup[token] if token in vlookup else None * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window # <<<<<<<<<<<<<< @@ -5873,7 +7026,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L6_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":632 +======= + /* "gensim/models/word2vec_inner.pyx":463 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sent: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -5882,7 +7039,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":634 +======= + /* "gensim/models/word2vec_inner.pyx":465 +>>>>>>> Fixing the computation of the Word2Vec loss. * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if c.sample and word.sample_int < random_int32(&c.next_random): # <<<<<<<<<<<<<< @@ -5895,6 +7056,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = __pyx_t_7; goto __pyx_L10_bool_binop_done; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_sample_int); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_6gensim_6models_14word2vec_inner_random_int32((&__pyx_v_c.next_random))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 634, __pyx_L1_error) @@ -5909,6 +7071,22 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT if (__pyx_t_6) { /* "gensim/models/word2vec_inner.pyx":635 +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_sample_int); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_6gensim_6models_14word2vec_inner_random_int32((&__pyx_v_next_random))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = PyObject_RichCompare(__pyx_t_1, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 465, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_4 = __pyx_t_7; + __pyx_L15_bool_binop_done:; + if (__pyx_t_4) { + + /* "gensim/models/word2vec_inner.pyx":466 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if c.sample and word.sample_int < random_int32(&c.next_random): * continue # <<<<<<<<<<<<<< @@ -5917,7 +7095,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L6_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":634 +======= + /* "gensim/models/word2vec_inner.pyx":465 +>>>>>>> Fixing the computation of the Word2Vec loss. * if word is None: * continue # leaving `effective_words` unchanged = shortening the sentence = expanding the window * if c.sample and word.sample_int < random_int32(&c.next_random): # <<<<<<<<<<<<<< @@ -5926,13 +7108,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":636 * if c.sample and word.sample_int < random_int32(&c.next_random): +======= + /* "gensim/models/word2vec_inner.pyx":467 + * if sample and word.sample_int < random_int32(&next_random): +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * c.indexes[effective_words] = word.index # <<<<<<<<<<<<<< * if c.hs: * c.codelens[effective_words] = len(word.code) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = __Pyx_PyInt_As_npy_uint32(__pyx_t_12); if (unlikely((__pyx_t_13 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 636, __pyx_L1_error) @@ -5940,6 +7128,15 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT (__pyx_v_c.indexes[__pyx_v_effective_words]) = __pyx_t_13; /* "gensim/models/word2vec_inner.pyx":637 +======= + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 467, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + (__pyx_v_indexes[__pyx_v_effective_words]) = __pyx_t_15; + + /* "gensim/models/word2vec_inner.pyx":468 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * c.indexes[effective_words] = word.index * if c.hs: # <<<<<<<<<<<<<< @@ -5949,6 +7146,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = (__pyx_v_c.hs != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":638 * c.indexes[effective_words] = word.index * if c.hs: @@ -5989,6 +7187,48 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; /* "gensim/models/word2vec_inner.pyx":637 +======= + /* "gensim/models/word2vec_inner.pyx":469 + * indexes[effective_words] = word.index + * if hs: + * codelens[effective_words] = len(word.code) # <<<<<<<<<<<<<< + * codes[effective_words] = np.PyArray_DATA(word.code) + * points[effective_words] = np.PyArray_DATA(word.point) + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_16 = PyObject_Length(__pyx_t_14); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 469, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + (__pyx_v_codelens[__pyx_v_effective_words]) = ((int)__pyx_t_16); + + /* "gensim/models/word2vec_inner.pyx":470 + * if hs: + * codelens[effective_words] = len(word.code) + * codes[effective_words] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< + * points[effective_words] = np.PyArray_DATA(word.point) + * effective_words += 1 + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 470, __pyx_L1_error) + (__pyx_v_codes[__pyx_v_effective_words]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_14))); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "gensim/models/word2vec_inner.pyx":471 + * codelens[effective_words] = len(word.code) + * codes[effective_words] = np.PyArray_DATA(word.code) + * points[effective_words] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< + * effective_words += 1 + * if effective_words == MAX_SENTENCE_LEN: + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 471, __pyx_L1_error) + (__pyx_v_points[__pyx_v_effective_words]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_14))); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "gensim/models/word2vec_inner.pyx":468 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * c.indexes[effective_words] = word.index * if c.hs: # <<<<<<<<<<<<<< @@ -5997,17 +7237,28 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":641 * c.codes[effective_words] = np.PyArray_DATA(word.code) * c.points[effective_words] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":472 + * codes[effective_words] = np.PyArray_DATA(word.code) + * points[effective_words] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * effective_words += 1 # <<<<<<<<<<<<<< * if effective_words == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? */ __pyx_v_effective_words = (__pyx_v_effective_words + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":642 * c.points[effective_words] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":473 + * points[effective_words] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< * break # TODO: log warning, tally overflow? @@ -6016,7 +7267,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = ((__pyx_v_effective_words == 0x2710) != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":643 +======= + /* "gensim/models/word2vec_inner.pyx":474 +>>>>>>> Fixing the computation of the Word2Vec loss. * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -6025,8 +7280,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L7_break; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":642 * c.points[effective_words] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":473 + * points[effective_words] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * effective_words += 1 * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< * break # TODO: log warning, tally overflow? @@ -6034,7 +7294,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":630 +======= + /* "gensim/models/word2vec_inner.pyx":461 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not sent: * continue # ignore empty sentences; leave effective_sentences unchanged * for token in sent: # <<<<<<<<<<<<<< @@ -6046,7 +7310,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_L7_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":648 +======= + /* "gensim/models/word2vec_inner.pyx":479 +>>>>>>> Fixing the computation of the Word2Vec loss. * # across sentence boundaries. * # indices of sentence number X are between >>>>>> Fixing the computation of the Word2Vec loss. * # indices of sentence number X are between >>>>>> Fixing the computation of the Word2Vec loss. * * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< * break # TODO: log warning, tally overflow? @@ -6074,7 +7351,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = ((__pyx_v_effective_words == 0x2710) != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":652 +======= + /* "gensim/models/word2vec_inner.pyx":483 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if effective_words == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -6083,8 +7364,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ goto __pyx_L4_break; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":651 * c.sentence_idx[effective_sentences] = effective_words +======= + /* "gensim/models/word2vec_inner.pyx":482 + * sentence_idx[effective_sentences] = effective_words +>>>>>>> Fixing the computation of the Word2Vec loss. * * if effective_words == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< * break # TODO: log warning, tally overflow? @@ -6092,7 +7378,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":627 +======= + /* "gensim/models/word2vec_inner.pyx":458 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 * for sent in sentences: # <<<<<<<<<<<<<< @@ -6104,13 +7394,18 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_L4_break:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":655 +======= + /* "gensim/models/word2vec_inner.pyx":486 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # precompute "reduced window" offsets in a single randint() call * for i, item in enumerate(model.random.randint(0, c.window, effective_words)): # <<<<<<<<<<<<<< * c.reduced_windows[i] = item * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_15 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -6128,32 +7423,66 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_10); +======= + __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_random); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_randint); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_window); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = NULL; + __pyx_t_17 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); + __Pyx_INCREF(__pyx_t_1); +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); __pyx_t_16 = 1; } } #if CYTHON_FAST_PYCALL +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (PyFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_int_0, __pyx_t_1, __pyx_t_11}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 3+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; +======= + if (PyFunction_Check(__pyx_t_14)) { + PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_int_0, __pyx_t_8, __pyx_t_13}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif #if CYTHON_FAST_PYCCALL +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_int_0, __pyx_t_1, __pyx_t_11}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 3+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; +======= + if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) { + PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_int_0, __pyx_t_8, __pyx_t_13}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 3+__pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_17 = PyTuple_New(3+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); if (__pyx_t_10) { @@ -6169,6 +7498,23 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_1 = 0; __pyx_t_11 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) +======= + __pyx_t_18 = PyTuple_New(3+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + if (__pyx_t_1) { + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_1); __pyx_t_1 = NULL; + } + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_17, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_17, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_17, __pyx_t_13); + __pyx_t_8 = 0; + __pyx_t_13 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; } @@ -6177,9 +7523,15 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_12 = __pyx_t_3; __Pyx_INCREF(__pyx_t_12); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_5 = Py_TYPE(__pyx_t_12)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 655, __pyx_L1_error) +======= + __pyx_t_6 = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 486, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = Py_TYPE(__pyx_t_14)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 486, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { @@ -6187,17 +7539,29 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT if (likely(PyList_CheckExact(__pyx_t_12))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_12)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 655, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_12, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) +======= + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_12)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 655, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_12, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 655, __pyx_L1_error) +======= + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 486, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_14, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); #endif } @@ -6207,7 +7571,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 else __PYX_ERR(0, 655, __pyx_L1_error) +======= + else __PYX_ERR(0, 486, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } break; } @@ -6218,17 +7586,28 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_v_i = __pyx_t_15; __pyx_t_15 = (__pyx_t_15 + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":656 +======= + /* "gensim/models/word2vec_inner.pyx":487 +>>>>>>> Fixing the computation of the Word2Vec loss. * # precompute "reduced window" offsets in a single randint() call * for i, item in enumerate(model.random.randint(0, c.window, effective_words)): * c.reduced_windows[i] = item # <<<<<<<<<<<<<< * * # release GIL & train on all sentences */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_13 = __Pyx_PyInt_As_npy_uint32(__pyx_v_item); if (unlikely((__pyx_t_13 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error) (__pyx_v_c.reduced_windows[__pyx_v_i]) = __pyx_t_13; /* "gensim/models/word2vec_inner.pyx":655 +======= + __pyx_t_15 = __Pyx_PyInt_As_npy_uint32(__pyx_v_item); if (unlikely((__pyx_t_15 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error) + (__pyx_v_reduced_windows[__pyx_v_i]) = __pyx_t_15; + + /* "gensim/models/word2vec_inner.pyx":486 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # precompute "reduced window" offsets in a single randint() call * for i, item in enumerate(model.random.randint(0, c.window, effective_words)): # <<<<<<<<<<<<<< @@ -6238,7 +7617,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":659 +======= + /* "gensim/models/word2vec_inner.pyx":490 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # release GIL & train on all sentences * with nogil: # <<<<<<<<<<<<<< @@ -6253,19 +7636,32 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT #endif /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":660 +======= + /* "gensim/models/word2vec_inner.pyx":491 +>>>>>>> Fixing the computation of the Word2Vec loss. * # release GIL & train on all sentences * with nogil: * for sent_idx in range(effective_sentences): # <<<<<<<<<<<<<< * idx_start = c.sentence_idx[sent_idx] * idx_end = c.sentence_idx[sent_idx + 1] */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_15 = __pyx_v_effective_sentences; __pyx_t_16 = __pyx_t_15; for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_16; __pyx_t_18+=1) { __pyx_v_sent_idx = __pyx_t_18; /* "gensim/models/word2vec_inner.pyx":661 +======= + __pyx_t_2 = __pyx_v_effective_sentences; + __pyx_t_17 = __pyx_t_2; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) { + __pyx_v_sent_idx = __pyx_t_19; + + /* "gensim/models/word2vec_inner.pyx":492 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for sent_idx in range(effective_sentences): * idx_start = c.sentence_idx[sent_idx] # <<<<<<<<<<<<<< @@ -6274,7 +7670,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_idx_start = (__pyx_v_c.sentence_idx[__pyx_v_sent_idx]); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":662 +======= + /* "gensim/models/word2vec_inner.pyx":493 +>>>>>>> Fixing the computation of the Word2Vec loss. * for sent_idx in range(effective_sentences): * idx_start = c.sentence_idx[sent_idx] * idx_end = c.sentence_idx[sent_idx + 1] # <<<<<<<<<<<<<< @@ -6283,13 +7683,20 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_idx_end = (__pyx_v_c.sentence_idx[(__pyx_v_sent_idx + 1)]); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":663 * idx_start = c.sentence_idx[sent_idx] * idx_end = c.sentence_idx[sent_idx + 1] +======= + /* "gensim/models/word2vec_inner.pyx":494 + * idx_start = sentence_idx[sent_idx] + * idx_end = sentence_idx[sent_idx + 1] +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(idx_start, idx_end): # <<<<<<<<<<<<<< * j = i - c.window + c.reduced_windows[i] * if j < idx_start: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_19 = __pyx_v_idx_end; __pyx_t_20 = __pyx_t_19; for (__pyx_t_21 = __pyx_v_idx_start; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) { @@ -6297,6 +7704,15 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT /* "gensim/models/word2vec_inner.pyx":664 * idx_end = c.sentence_idx[sent_idx + 1] +======= + __pyx_t_20 = __pyx_v_idx_end; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = __pyx_v_idx_start; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_i = __pyx_t_22; + + /* "gensim/models/word2vec_inner.pyx":495 + * idx_end = sentence_idx[sent_idx + 1] +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(idx_start, idx_end): * j = i - c.window + c.reduced_windows[i] # <<<<<<<<<<<<<< * if j < idx_start: @@ -6304,7 +7720,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_j = ((__pyx_v_i - __pyx_v_c.window) + (__pyx_v_c.reduced_windows[__pyx_v_i])); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":665 +======= + /* "gensim/models/word2vec_inner.pyx":496 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(idx_start, idx_end): * j = i - c.window + c.reduced_windows[i] * if j < idx_start: # <<<<<<<<<<<<<< @@ -6314,8 +7734,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = ((__pyx_v_j < __pyx_v_idx_start) != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":666 * j = i - c.window + c.reduced_windows[i] +======= + /* "gensim/models/word2vec_inner.pyx":497 + * j = i - window + reduced_windows[i] +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < idx_start: * j = idx_start # <<<<<<<<<<<<<< * k = i + c.window + 1 - c.reduced_windows[i] @@ -6323,7 +7748,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_j = __pyx_v_idx_start; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":665 +======= + /* "gensim/models/word2vec_inner.pyx":496 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(idx_start, idx_end): * j = i - c.window + c.reduced_windows[i] * if j < idx_start: # <<<<<<<<<<<<<< @@ -6332,7 +7761,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":667 +======= + /* "gensim/models/word2vec_inner.pyx":498 +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < idx_start: * j = idx_start * k = i + c.window + 1 - c.reduced_windows[i] # <<<<<<<<<<<<<< @@ -6341,7 +7774,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_k = (((__pyx_v_i + __pyx_v_c.window) + 1) - (__pyx_v_c.reduced_windows[__pyx_v_i])); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":668 +======= + /* "gensim/models/word2vec_inner.pyx":499 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = idx_start * k = i + c.window + 1 - c.reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< @@ -6351,8 +7788,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = ((__pyx_v_k > __pyx_v_idx_end) != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":669 * k = i + c.window + 1 - c.reduced_windows[i] +======= + /* "gensim/models/word2vec_inner.pyx":500 + * k = i + window + 1 - reduced_windows[i] +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > idx_end: * k = idx_end # <<<<<<<<<<<<<< * if c.hs: @@ -6360,7 +7802,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_v_k = __pyx_v_idx_end; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":668 +======= + /* "gensim/models/word2vec_inner.pyx":499 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = idx_start * k = i + c.window + 1 - c.reduced_windows[i] * if k > idx_end: # <<<<<<<<<<<<<< @@ -6369,7 +7815,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":670 +======= + /* "gensim/models/word2vec_inner.pyx":501 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > idx_end: * k = idx_end * if c.hs: # <<<<<<<<<<<<<< @@ -6379,7 +7829,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT __pyx_t_6 = (__pyx_v_c.hs != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":671 +======= + /* "gensim/models/word2vec_inner.pyx":502 +>>>>>>> Fixing the computation of the Word2Vec loss. * k = idx_end * if c.hs: * w2v_fast_sentence_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.word_locks, c.compute_loss, &c.running_training_loss) # <<<<<<<<<<<<<< @@ -6388,7 +7842,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ __pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_cbow_hs((__pyx_v_c.points[__pyx_v_i]), (__pyx_v_c.codes[__pyx_v_i]), __pyx_v_c.codelens, __pyx_v_c.neu1, __pyx_v_c.syn0, __pyx_v_c.syn1, __pyx_v_c.size, __pyx_v_c.indexes, __pyx_v_c.alpha, __pyx_v_c.work, __pyx_v_i, __pyx_v_j, __pyx_v_k, __pyx_v_c.cbow_mean, __pyx_v_c.word_locks, __pyx_v_c.compute_loss, (&__pyx_v_c.running_training_loss)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":670 +======= + /* "gensim/models/word2vec_inner.pyx":501 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > idx_end: * k = idx_end * if c.hs: # <<<<<<<<<<<<<< @@ -6397,30 +7855,55 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":672 * if c.hs: * w2v_fast_sentence_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: # <<<<<<<<<<<<<< * c.next_random = w2v_fast_sentence_cbow_neg(c.negative, c.cum_table, c.cum_table_len, c.codelens, c.neu1, c.syn0, c.syn1neg, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) +======= + /* "gensim/models/word2vec_inner.pyx":503 + * if hs: + * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) + * if negative: # <<<<<<<<<<<<<< + * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) +>>>>>>> Fixing the computation of the Word2Vec loss. * */ __pyx_t_6 = (__pyx_v_c.negative != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":673 * w2v_fast_sentence_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: * c.next_random = w2v_fast_sentence_cbow_neg(c.negative, c.cum_table, c.cum_table_len, c.codelens, c.neu1, c.syn0, c.syn1neg, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) # <<<<<<<<<<<<<< * * model.running_training_loss = c.running_training_loss +======= + /* "gensim/models/word2vec_inner.pyx":504 + * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) + * if negative: + * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) # <<<<<<<<<<<<<< + * + * model.running_training_loss += _running_training_loss +>>>>>>> Fixing the computation of the Word2Vec loss. */ __pyx_v_c.next_random = __pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_cbow_neg(__pyx_v_c.negative, __pyx_v_c.cum_table, __pyx_v_c.cum_table_len, __pyx_v_c.codelens, __pyx_v_c.neu1, __pyx_v_c.syn0, __pyx_v_c.syn1neg, __pyx_v_c.size, __pyx_v_c.indexes, __pyx_v_c.alpha, __pyx_v_c.work, __pyx_v_i, __pyx_v_j, __pyx_v_k, __pyx_v_c.cbow_mean, __pyx_v_c.next_random, __pyx_v_c.word_locks, __pyx_v_c.compute_loss, (&__pyx_v_c.running_training_loss)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":672 * if c.hs: * w2v_fast_sentence_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.word_locks, c.compute_loss, &c.running_training_loss) * if c.negative: # <<<<<<<<<<<<<< * c.next_random = w2v_fast_sentence_cbow_neg(c.negative, c.cum_table, c.cum_table_len, c.codelens, c.neu1, c.syn0, c.syn1neg, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) +======= + /* "gensim/models/word2vec_inner.pyx":503 + * if hs: + * fast_sentence_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, _alpha, work, i, j, k, cbow_mean, word_locks, _compute_loss, &_running_training_loss) + * if negative: # <<<<<<<<<<<<<< + * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) +>>>>>>> Fixing the computation of the Word2Vec loss. * */ } @@ -6428,7 +7911,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":659 +======= + /* "gensim/models/word2vec_inner.pyx":490 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # release GIL & train on all sentences * with nogil: # <<<<<<<<<<<<<< @@ -6447,6 +7934,7 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":675 * c.next_random = w2v_fast_sentence_cbow_neg(c.negative, c.cum_table, c.cum_table_len, c.codelens, c.neu1, c.syn0, c.syn1neg, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) * @@ -6463,10 +7951,35 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT * * model.running_training_loss = c.running_training_loss * return effective_words # <<<<<<<<<<<<<< +======= + /* "gensim/models/word2vec_inner.pyx":506 + * next_random = fast_sentence_cbow_neg(negative, cum_table, cum_table_len, codelens, neu1, syn0, syn1neg, size, indexes, _alpha, work, i, j, k, cbow_mean, next_random, word_locks, _compute_loss, &_running_training_loss) + * + * model.running_training_loss += _running_training_loss # <<<<<<<<<<<<<< + * return effective_words, effective_words + * + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v__running_training_loss); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_18 = PyNumber_InPlaceAdd(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_model, __pyx_n_s_running_training_loss, __pyx_t_18) < 0) __PYX_ERR(0, 506, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + + /* "gensim/models/word2vec_inner.pyx":507 + * + * model.running_training_loss += _running_training_loss + * return effective_words, effective_words # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * * */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_r = __pyx_t_12; @@ -6474,6 +7987,25 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT goto __pyx_L0; /* "gensim/models/word2vec_inner.pyx":591 +======= + __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_effective_words); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 507, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_18); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_3); + __pyx_t_18 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L0; + + /* "gensim/models/word2vec_inner.pyx":404 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< @@ -6502,8 +8034,12 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_2train_batch_cbow(CYT return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":679 * +======= +/* "gensim/models/word2vec_inner.pyx":511 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted skip-gram representation. @@ -6546,17 +8082,29 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_5score_sentence_sg(Py case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 1); __PYX_ERR(0, 679, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 1); __PYX_ERR(0, 511, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 2); __PYX_ERR(0, 679, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_sg") < 0)) __PYX_ERR(0, 679, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, 2); __PYX_ERR(0, 511, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_sg") < 0)) __PYX_ERR(0, 511, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6571,7 +8119,11 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_5score_sentence_sg(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 679, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_sg", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 511, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.score_sentence_sg", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6613,13 +8165,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY int __pyx_t_15; __Pyx_RefNannySetupContext("score_sentence_sg", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":703 * """ * cdef Word2VecConfig c * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * c.size = model.wv.vector_size +======= + /* "gensim/models/word2vec_inner.pyx":513 + * def score_sentence_sg(model, sentence, _work): +>>>>>>> Fixing the computation of the Word2Vec loss. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 703, __pyx_L1_error) @@ -6633,18 +8191,43 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY * cdef Word2VecConfig c * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) * c.size = model.wv.vector_size # <<<<<<<<<<<<<< +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 513, __pyx_L1_error) + __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gensim/models/word2vec_inner.pyx":515 + * cdef REAL_t *syn0 = (np.PyArray_DATA(model.wv.vectors)) + * cdef REAL_t *work + * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * * c.window = model.window */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 704, __pyx_L1_error) +======= + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 515, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c.size = __pyx_t_3; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":706 * c.size = model.wv.vector_size * @@ -6655,10 +8238,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 706, __pyx_L1_error) +======= + /* "gensim/models/word2vec_inner.pyx":520 + * cdef np.uint32_t indexes[MAX_SENTENCE_LEN] + * cdef int sentence_len + * cdef int window = model.window # <<<<<<<<<<<<<< + * + * cdef int i, j, k + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 520, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c.window = __pyx_t_3; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":709 +======= + /* "gensim/models/word2vec_inner.pyx":523 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef int i, j, k * cdef long result = 0 # <<<<<<<<<<<<<< @@ -6667,13 +8266,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_result = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":712 * cdef int sentence_len +======= + /* "gensim/models/word2vec_inner.pyx":529 + * cdef np.uint8_t *codes[MAX_SENTENCE_LEN] +>>>>>>> Fixing the computation of the Word2Vec loss. * * c.syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error) @@ -6684,31 +8289,61 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "gensim/models/word2vec_inner.pyx":715 +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 529, __pyx_L1_error) + __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gensim/models/word2vec_inner.pyx":532 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # convert Python structures to primitive types, so we can release the GIL * c.work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< * * vlookup = model.wv.vocab */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 715, __pyx_L1_error) __pyx_v_c.work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); /* "gensim/models/word2vec_inner.pyx":717 * c.work = np.PyArray_DATA(_work) +======= + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 532, __pyx_L1_error) + __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); + + /* "gensim/models/word2vec_inner.pyx":534 + * work = np.PyArray_DATA(_work) +>>>>>>> Fixing the computation of the Word2Vec loss. * * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * i = 0 * for token in sentence: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error) +======= + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_vlookup = __pyx_t_1; __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":718 +======= + /* "gensim/models/word2vec_inner.pyx":535 +>>>>>>> Fixing the computation of the Word2Vec loss. * * vlookup = model.wv.vocab * i = 0 # <<<<<<<<<<<<<< @@ -6717,7 +8352,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_i = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":719 +======= + /* "gensim/models/word2vec_inner.pyx":536 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -6728,26 +8367,44 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_1 = __pyx_v_sentence; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 719, __pyx_L1_error) +======= + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 719, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) +======= + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 719, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) +======= + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 536, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_2); #endif } @@ -6757,7 +8414,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 else __PYX_ERR(0, 719, __pyx_L1_error) +======= + else __PYX_ERR(0, 536, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } break; } @@ -6766,16 +8427,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_2); __pyx_t_2 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":720 +======= + /* "gensim/models/word2vec_inner.pyx":537 +>>>>>>> Fixing the computation of the Word2Vec loss. * i = 0 * for token in sentence: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # should drop the */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 720, __pyx_L1_error) if ((__pyx_t_6 != 0)) { __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 720, __pyx_L1_error) +======= + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 537, __pyx_L1_error) + if ((__pyx_t_6 != 0)) { + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; @@ -6786,7 +8457,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_2); __pyx_t_2 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":721 +======= + /* "gensim/models/word2vec_inner.pyx":538 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -6797,7 +8472,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = (__pyx_t_6 != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":722 +======= + /* "gensim/models/word2vec_inner.pyx":539 +>>>>>>> Fixing the computation of the Word2Vec loss. * word = vlookup[token] if token in vlookup else None * if word is None: * continue # should drop the # <<<<<<<<<<<<<< @@ -6806,7 +8485,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L3_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":721 +======= + /* "gensim/models/word2vec_inner.pyx":538 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -6815,32 +8498,53 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":723 +======= + /* "gensim/models/word2vec_inner.pyx":540 +>>>>>>> Fixing the computation of the Word2Vec loss. * if word is None: * continue # should drop the * c.indexes[i] = word.index # <<<<<<<<<<<<<< * c.codelens[i] = len(word.code) * c.codes[i] = np.PyArray_DATA(word.code) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L1_error) +======= + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_c.indexes[__pyx_v_i]) = __pyx_t_9; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":724 +======= + /* "gensim/models/word2vec_inner.pyx":541 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue # should drop the * c.indexes[i] = word.index * c.codelens[i] = len(word.code) # <<<<<<<<<<<<<< * c.codes[i] = np.PyArray_DATA(word.code) * c.points[i] = np.PyArray_DATA(word.point) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 724, __pyx_L1_error) +======= + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 541, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_c.codelens[__pyx_v_i]) = ((int)__pyx_t_10); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":725 * c.indexes[i] = word.index * c.codelens[i] = len(word.code) @@ -6870,14 +8574,50 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY /* "gensim/models/word2vec_inner.pyx":727 * c.codes[i] = np.PyArray_DATA(word.code) * c.points[i] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":542 + * indexes[i] = word.index + * codelens[i] = len(word.code) + * codes[i] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< + * points[i] = np.PyArray_DATA(word.point) + * result += 1 + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 542, __pyx_L1_error) + (__pyx_v_codes[__pyx_v_i]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gensim/models/word2vec_inner.pyx":543 + * codelens[i] = len(word.code) + * codes[i] = np.PyArray_DATA(word.code) + * points[i] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< + * result += 1 + * i += 1 + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 543, __pyx_L1_error) + (__pyx_v_points[__pyx_v_i]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_2))); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "gensim/models/word2vec_inner.pyx":544 + * codes[i] = np.PyArray_DATA(word.code) + * points[i] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 # <<<<<<<<<<<<<< * i += 1 * if i == MAX_SENTENCE_LEN: */ __pyx_v_result = (__pyx_v_result + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":728 * c.points[i] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":545 + * points[i] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 # <<<<<<<<<<<<<< * if i == MAX_SENTENCE_LEN: @@ -6885,7 +8625,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_i = (__pyx_v_i + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":729 +======= + /* "gensim/models/word2vec_inner.pyx":546 +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -6895,7 +8639,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_i == 0x2710) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":730 +======= + /* "gensim/models/word2vec_inner.pyx":547 +>>>>>>> Fixing the computation of the Word2Vec loss. * i += 1 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -6904,7 +8652,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L4_break; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":729 +======= + /* "gensim/models/word2vec_inner.pyx":546 +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -6913,7 +8665,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":719 +======= + /* "gensim/models/word2vec_inner.pyx":536 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -6925,7 +8681,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_L4_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":731 +======= + /* "gensim/models/word2vec_inner.pyx":548 +>>>>>>> Fixing the computation of the Word2Vec loss. * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? * sentence_len = i # <<<<<<<<<<<<<< @@ -6934,7 +8694,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_sentence_len = __pyx_v_i; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":734 +======= + /* "gensim/models/word2vec_inner.pyx":551 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # release GIL & train on the sentence * c.work[0] = 0.0 # <<<<<<<<<<<<<< @@ -6943,8 +8707,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ (__pyx_v_c.work[0]) = 0.0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":736 * c.work[0] = 0.0 +======= + /* "gensim/models/word2vec_inner.pyx":553 + * work[0] = 0.0 +>>>>>>> Fixing the computation of the Word2Vec loss. * * with nogil: # <<<<<<<<<<<<<< * for i in range(sentence_len): @@ -6958,7 +8727,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY #endif /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":737 +======= + /* "gensim/models/word2vec_inner.pyx":554 +>>>>>>> Fixing the computation of the Word2Vec loss. * * with nogil: * for i in range(sentence_len): # <<<<<<<<<<<<<< @@ -6970,7 +8743,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":738 +======= + /* "gensim/models/word2vec_inner.pyx":555 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for i in range(sentence_len): * if c.codelens[i] == 0: # <<<<<<<<<<<<<< @@ -6980,7 +8757,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = (((__pyx_v_c.codelens[__pyx_v_i]) == 0) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":739 +======= + /* "gensim/models/word2vec_inner.pyx":556 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(sentence_len): * if c.codelens[i] == 0: * continue # <<<<<<<<<<<<<< @@ -6989,7 +8770,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L10_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":738 +======= + /* "gensim/models/word2vec_inner.pyx":555 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for i in range(sentence_len): * if c.codelens[i] == 0: # <<<<<<<<<<<<<< @@ -6998,8 +8783,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":740 * if c.codelens[i] == 0: +======= + /* "gensim/models/word2vec_inner.pyx":557 + * if codelens[i] == 0: +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window # <<<<<<<<<<<<<< * if j < 0: @@ -7007,7 +8797,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_j = (__pyx_v_i - __pyx_v_c.window); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":741 +======= + /* "gensim/models/word2vec_inner.pyx":558 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window * if j < 0: # <<<<<<<<<<<<<< @@ -7017,8 +8811,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_j < 0) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":742 * j = i - c.window +======= + /* "gensim/models/word2vec_inner.pyx":559 + * j = i - window +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < 0: * j = 0 # <<<<<<<<<<<<<< * k = i + c.window + 1 @@ -7026,7 +8825,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_j = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":741 +======= + /* "gensim/models/word2vec_inner.pyx":558 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window * if j < 0: # <<<<<<<<<<<<<< @@ -7035,7 +8838,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":743 +======= + /* "gensim/models/word2vec_inner.pyx":560 +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < 0: * j = 0 * k = i + c.window + 1 # <<<<<<<<<<<<<< @@ -7044,7 +8851,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_k = ((__pyx_v_i + __pyx_v_c.window) + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":744 +======= + /* "gensim/models/word2vec_inner.pyx":561 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = 0 * k = i + c.window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7054,8 +8865,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_t_8 = ((__pyx_v_k > __pyx_v_sentence_len) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":745 * k = i + c.window + 1 +======= + /* "gensim/models/word2vec_inner.pyx":562 + * k = i + window + 1 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > sentence_len: * k = sentence_len # <<<<<<<<<<<<<< * for j in range(j, k): @@ -7063,7 +8879,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ __pyx_v_k = __pyx_v_sentence_len; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":744 +======= + /* "gensim/models/word2vec_inner.pyx":561 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = 0 * k = i + c.window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7072,7 +8892,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":746 +======= + /* "gensim/models/word2vec_inner.pyx":563 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > sentence_len: * k = sentence_len * for j in range(j, k): # <<<<<<<<<<<<<< @@ -7084,7 +8908,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY for (__pyx_t_15 = __pyx_v_j; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":747 +======= + /* "gensim/models/word2vec_inner.pyx":564 +>>>>>>> Fixing the computation of the Word2Vec loss. * k = sentence_len * for j in range(j, k): * if j == i or c.codelens[j] == 0: # <<<<<<<<<<<<<< @@ -7102,7 +8930,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY __pyx_L18_bool_binop_done:; if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":748 +======= + /* "gensim/models/word2vec_inner.pyx":565 +>>>>>>> Fixing the computation of the Word2Vec loss. * for j in range(j, k): * if j == i or c.codelens[j] == 0: * continue # <<<<<<<<<<<<<< @@ -7111,7 +8943,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ goto __pyx_L15_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":747 +======= + /* "gensim/models/word2vec_inner.pyx":564 +>>>>>>> Fixing the computation of the Word2Vec loss. * k = sentence_len * for j in range(j, k): * if j == i or c.codelens[j] == 0: # <<<<<<<<<<<<<< @@ -7120,8 +8956,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":749 * if j == i or c.codelens[j] == 0: +======= + /* "gensim/models/word2vec_inner.pyx":566 + * if j == i or codelens[j] == 0: +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * score_pair_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.work) # <<<<<<<<<<<<<< * @@ -7134,8 +8975,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":736 * c.work[0] = 0.0 +======= + /* "gensim/models/word2vec_inner.pyx":553 + * work[0] = 0.0 +>>>>>>> Fixing the computation of the Word2Vec loss. * * with nogil: # <<<<<<<<<<<<<< * for i in range(sentence_len): @@ -7153,22 +8999,35 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":751 * score_pair_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.work) +======= + /* "gensim/models/word2vec_inner.pyx":568 + * score_pair_sg_hs(points[i], codes[i], codelens[i], syn0, syn1, size, indexes[j], work) +>>>>>>> Fixing the computation of the Word2Vec loss. * * return c.work[0] # <<<<<<<<<<<<<< * * cdef void score_pair_sg_hs( */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyFloat_FromDouble((__pyx_v_c.work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error) +======= + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":679 * +======= + /* "gensim/models/word2vec_inner.pyx":511 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted skip-gram representation. @@ -7191,8 +9050,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_4score_sentence_sg(CY return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":753 * return c.work[0] +======= +/* "gensim/models/word2vec_inner.pyx":570 + * return work[0] +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef void score_pair_sg_hs( # <<<<<<<<<<<<<< * const np.uint32_t *word_point, const np.uint8_t *word_code, const int codelen, @@ -7212,7 +9076,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n int __pyx_t_5; long __pyx_t_6; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":759 +======= + /* "gensim/models/word2vec_inner.pyx":576 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef long long b * cdef long long row1 = word2_index * size, row2, sgn # <<<<<<<<<<<<<< @@ -7221,7 +9089,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_row1 = (__pyx_v_word2_index * __pyx_v_size); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":762 +======= + /* "gensim/models/word2vec_inner.pyx":579 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef REAL_t f * * for b in range(codelen): # <<<<<<<<<<<<<< @@ -7233,7 +9105,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_b = __pyx_t_3; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":763 +======= + /* "gensim/models/word2vec_inner.pyx":580 +>>>>>>> Fixing the computation of the Word2Vec loss. * * for b in range(codelen): * row2 = word_point[b] * size # <<<<<<<<<<<<<< @@ -7242,7 +9118,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_row2 = ((__pyx_v_word_point[__pyx_v_b]) * __pyx_v_size); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":764 +======= + /* "gensim/models/word2vec_inner.pyx":581 +>>>>>>> Fixing the computation of the Word2Vec loss. * for b in range(codelen): * row2 = word_point[b] * size * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) # <<<<<<<<<<<<<< @@ -7251,7 +9131,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = __pyx_v_6gensim_6models_14word2vec_inner_our_dot((&__pyx_v_size), (&(__pyx_v_syn0[__pyx_v_row1])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), (&(__pyx_v_syn1[__pyx_v_row2])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":765 +======= + /* "gensim/models/word2vec_inner.pyx":582 +>>>>>>> Fixing the computation of the Word2Vec loss. * row2 = word_point[b] * size * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 # <<<<<<<<<<<<<< @@ -7260,7 +9144,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_sgn = __Pyx_pow_long(-1L, ((long)(__pyx_v_word_code[__pyx_v_b]))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":766 +======= + /* "gensim/models/word2vec_inner.pyx":583 +>>>>>>> Fixing the computation of the Word2Vec loss. * f = our_dot(&size, &syn0[row1], &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn # <<<<<<<<<<<<<< @@ -7269,7 +9157,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = (__pyx_v_f * __pyx_v_sgn); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":767 +======= + /* "gensim/models/word2vec_inner.pyx":584 +>>>>>>> Fixing the computation of the Word2Vec loss. * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -7287,7 +9179,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n __pyx_L6_bool_binop_done:; if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":768 +======= + /* "gensim/models/word2vec_inner.pyx":585 +>>>>>>> Fixing the computation of the Word2Vec loss. * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: * continue # <<<<<<<<<<<<<< @@ -7296,7 +9192,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ goto __pyx_L3_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":767 +======= + /* "gensim/models/word2vec_inner.pyx":584 +>>>>>>> Fixing the computation of the Word2Vec loss. * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -7305,7 +9205,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":769 +======= + /* "gensim/models/word2vec_inner.pyx":586 +>>>>>>> Fixing the computation of the Word2Vec loss. * if f <= -MAX_EXP or f >= MAX_EXP: * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] # <<<<<<<<<<<<<< @@ -7314,7 +9218,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n */ __pyx_v_f = (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[((int)((__pyx_v_f + 6.0) * 83.0))]); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":770 +======= + /* "gensim/models/word2vec_inner.pyx":587 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] * work[0] += f # <<<<<<<<<<<<<< @@ -7326,8 +9234,13 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n __pyx_L3_continue:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":753 * return c.work[0] +======= + /* "gensim/models/word2vec_inner.pyx":570 + * return work[0] +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef void score_pair_sg_hs( # <<<<<<<<<<<<<< * const np.uint32_t *word_point, const np.uint8_t *word_code, const int codelen, @@ -7337,7 +9250,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_sg_hs(__pyx_t_5n /* function exit code */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":772 +======= +/* "gensim/models/word2vec_inner.pyx":589 +>>>>>>> Fixing the computation of the Word2Vec loss. * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< @@ -7384,23 +9301,39 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_7score_sentence_cbow( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sentence)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 1); __PYX_ERR(0, 772, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 1); __PYX_ERR(0, 589, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_work)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 2); __PYX_ERR(0, 772, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 2); __PYX_ERR(0, 589, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_neu1)) != 0)) kw_args--; else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 3); __PYX_ERR(0, 772, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_cbow") < 0)) __PYX_ERR(0, 772, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, 3); __PYX_ERR(0, 589, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "score_sentence_cbow") < 0)) __PYX_ERR(0, 589, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -7417,7 +9350,11 @@ static PyObject *__pyx_pw_6gensim_6models_14word2vec_inner_7score_sentence_cbow( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 772, __pyx_L3_error) +======= + __Pyx_RaiseArgtupleInvalid("score_sentence_cbow", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 589, __pyx_L3_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __pyx_L3_error:; __Pyx_AddTraceback("gensim.models.word2vec_inner.score_sentence_cbow", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7456,26 +9393,43 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( int __pyx_t_12; __Pyx_RefNannySetupContext("score_sentence_cbow", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":799 * cdef Word2VecConfig c +======= + /* "gensim/models/word2vec_inner.pyx":591 + * def score_sentence_cbow(model, sentence, _work, _neu1): +>>>>>>> Fixing the computation of the Word2Vec loss. * * c.cbow_mean = model.cbow_mean # <<<<<<<<<<<<<< * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) * c.size = model.wv.vector_size */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L1_error) +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_cbow_mean); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 591, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c.cbow_mean = __pyx_t_2; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":800 +======= + /* "gensim/models/word2vec_inner.pyx":593 + * cdef int cbow_mean = model.cbow_mean +>>>>>>> Fixing the computation of the Word2Vec loss. * * c.cbow_mean = model.cbow_mean * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) # <<<<<<<<<<<<<< * c.size = model.wv.vector_size * c.window = model.window */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 800, __pyx_L1_error) @@ -7490,17 +9444,42 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) * c.size = model.wv.vector_size # <<<<<<<<<<<<<< * c.window = model.window +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_vectors); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 593, __pyx_L1_error) + __pyx_v_syn0 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":596 + * cdef REAL_t *work + * cdef REAL_t *neu1 + * cdef int size = model.wv.vector_size # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vector_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c.size = __pyx_t_2; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":802 * c.syn0 = (np.PyArray_DATA(model.wv.vectors)) * c.size = model.wv.vector_size @@ -7511,10 +9490,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L1_error) +======= + /* "gensim/models/word2vec_inner.pyx":601 + * cdef np.uint32_t indexes[MAX_SENTENCE_LEN] + * cdef int sentence_len + * cdef int window = model.window # <<<<<<<<<<<<<< + * + * cdef int i, j, k + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_window); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 601, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c.window = __pyx_t_2; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":805 +======= + /* "gensim/models/word2vec_inner.pyx":604 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef int i, j, k * cdef long result = 0 # <<<<<<<<<<<<<< @@ -7523,13 +9518,19 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_result = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":807 * cdef long result = 0 +======= + /* "gensim/models/word2vec_inner.pyx":611 + * cdef np.uint8_t *codes[MAX_SENTENCE_LEN] +>>>>>>> Fixing the computation of the Word2Vec loss. * * c.syn1 = (np.PyArray_DATA(model.trainables.syn1)) # <<<<<<<<<<<<<< * * # convert Python structures to primitive types, so we can release the GIL */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error) @@ -7540,41 +9541,78 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "gensim/models/word2vec_inner.pyx":810 +======= + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_trainables); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_syn1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 611, __pyx_L1_error) + __pyx_v_syn1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":614 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # convert Python structures to primitive types, so we can release the GIL * c.work = np.PyArray_DATA(_work) # <<<<<<<<<<<<<< * c.neu1 = np.PyArray_DATA(_neu1) * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 810, __pyx_L1_error) __pyx_v_c.work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); /* "gensim/models/word2vec_inner.pyx":811 +======= + if (!(likely(((__pyx_v__work) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__work, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 614, __pyx_L1_error) + __pyx_v_work = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__work))); + + /* "gensim/models/word2vec_inner.pyx":615 +>>>>>>> Fixing the computation of the Word2Vec loss. * # convert Python structures to primitive types, so we can release the GIL * c.work = np.PyArray_DATA(_work) * c.neu1 = np.PyArray_DATA(_neu1) # <<<<<<<<<<<<<< * * vlookup = model.wv.vocab */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 811, __pyx_L1_error) __pyx_v_c.neu1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__neu1))); /* "gensim/models/word2vec_inner.pyx":813 * c.neu1 = np.PyArray_DATA(_neu1) +======= + if (!(likely(((__pyx_v__neu1) == Py_None) || likely(__Pyx_TypeTest(__pyx_v__neu1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_v_neu1 = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)PyArray_DATA(((PyArrayObject *)__pyx_v__neu1))); + + /* "gensim/models/word2vec_inner.pyx":617 + * neu1 = np.PyArray_DATA(_neu1) +>>>>>>> Fixing the computation of the Word2Vec loss. * * vlookup = model.wv.vocab # <<<<<<<<<<<<<< * i = 0 * for token in sentence: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 813, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_model, __pyx_n_s_wv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_vocab); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_vlookup = __pyx_t_1; __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":814 +======= + /* "gensim/models/word2vec_inner.pyx":618 +>>>>>>> Fixing the computation of the Word2Vec loss. * * vlookup = model.wv.vocab * i = 0 # <<<<<<<<<<<<<< @@ -7583,7 +9621,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_i = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":815 +======= + /* "gensim/models/word2vec_inner.pyx":619 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -7594,26 +9636,44 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_1 = __pyx_v_sentence; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 815, __pyx_L1_error) +======= + __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_sentence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 815, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 815, __pyx_L1_error) +======= + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 815, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 815, __pyx_L1_error) +======= + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); #endif } @@ -7623,7 +9683,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 else __PYX_ERR(0, 815, __pyx_L1_error) +======= + else __PYX_ERR(0, 619, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } break; } @@ -7632,16 +9696,26 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __Pyx_XDECREF_SET(__pyx_v_token, __pyx_t_3); __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":816 +======= + /* "gensim/models/word2vec_inner.pyx":620 +>>>>>>> Fixing the computation of the Word2Vec loss. * i = 0 * for token in sentence: * word = vlookup[token] if token in vlookup else None # <<<<<<<<<<<<<< * if word is None: * continue # for score, should this be a default negative value? */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 816, __pyx_L1_error) if ((__pyx_t_6 != 0)) { __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 816, __pyx_L1_error) +======= + __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_v_token, __pyx_v_vlookup, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 620, __pyx_L1_error) + if ((__pyx_t_6 != 0)) { + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_vlookup, __pyx_v_token); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 620, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; @@ -7652,7 +9726,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __Pyx_XDECREF_SET(__pyx_v_word, __pyx_t_3); __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":817 +======= + /* "gensim/models/word2vec_inner.pyx":621 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -7663,7 +9741,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = (__pyx_t_6 != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":818 +======= + /* "gensim/models/word2vec_inner.pyx":622 +>>>>>>> Fixing the computation of the Word2Vec loss. * word = vlookup[token] if token in vlookup else None * if word is None: * continue # for score, should this be a default negative value? # <<<<<<<<<<<<<< @@ -7672,7 +9754,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L3_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":817 +======= + /* "gensim/models/word2vec_inner.pyx":621 +>>>>>>> Fixing the computation of the Word2Vec loss. * for token in sentence: * word = vlookup[token] if token in vlookup else None * if word is None: # <<<<<<<<<<<<<< @@ -7681,32 +9767,53 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":819 +======= + /* "gensim/models/word2vec_inner.pyx":623 +>>>>>>> Fixing the computation of the Word2Vec loss. * if word is None: * continue # for score, should this be a default negative value? * c.indexes[i] = word.index # <<<<<<<<<<<<<< * c.codelens[i] = len(word.code) * c.codes[i] = np.PyArray_DATA(word.code) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_3); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyInt_As_npy_uint32(__pyx_t_3); if (unlikely((__pyx_t_9 == ((npy_uint32)-1)) && PyErr_Occurred())) __PYX_ERR(0, 623, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_c.indexes[__pyx_v_i]) = __pyx_t_9; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":820 +======= + /* "gensim/models/word2vec_inner.pyx":624 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue # for score, should this be a default negative value? * c.indexes[i] = word.index * c.codelens[i] = len(word.code) # <<<<<<<<<<<<<< * c.codes[i] = np.PyArray_DATA(word.code) * c.points[i] = np.PyArray_DATA(word.point) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 820, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_c.codelens[__pyx_v_i]) = ((int)__pyx_t_10); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":821 * c.indexes[i] = word.index * c.codelens[i] = len(word.code) @@ -7736,14 +9843,50 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( /* "gensim/models/word2vec_inner.pyx":823 * c.codes[i] = np.PyArray_DATA(word.code) * c.points[i] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":625 + * indexes[i] = word.index + * codelens[i] = len(word.code) + * codes[i] = np.PyArray_DATA(word.code) # <<<<<<<<<<<<<< + * points[i] = np.PyArray_DATA(word.point) + * result += 1 + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 625, __pyx_L1_error) + (__pyx_v_codes[__pyx_v_i]) = ((__pyx_t_5numpy_uint8_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":626 + * codelens[i] = len(word.code) + * codes[i] = np.PyArray_DATA(word.code) + * points[i] = np.PyArray_DATA(word.point) # <<<<<<<<<<<<<< + * result += 1 + * i += 1 + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_word, __pyx_n_s_point); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 626, __pyx_L1_error) + (__pyx_v_points[__pyx_v_i]) = ((__pyx_t_5numpy_uint32_t *)PyArray_DATA(((PyArrayObject *)__pyx_t_3))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "gensim/models/word2vec_inner.pyx":627 + * codes[i] = np.PyArray_DATA(word.code) + * points[i] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 # <<<<<<<<<<<<<< * i += 1 * if i == MAX_SENTENCE_LEN: */ __pyx_v_result = (__pyx_v_result + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":824 * c.points[i] = np.PyArray_DATA(word.point) +======= + /* "gensim/models/word2vec_inner.pyx":628 + * points[i] = np.PyArray_DATA(word.point) +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 # <<<<<<<<<<<<<< * if i == MAX_SENTENCE_LEN: @@ -7751,7 +9894,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_i = (__pyx_v_i + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":825 +======= + /* "gensim/models/word2vec_inner.pyx":629 +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -7761,7 +9908,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_i == 0x2710) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":826 +======= + /* "gensim/models/word2vec_inner.pyx":630 +>>>>>>> Fixing the computation of the Word2Vec loss. * i += 1 * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? # <<<<<<<<<<<<<< @@ -7770,7 +9921,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L4_break; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":825 +======= + /* "gensim/models/word2vec_inner.pyx":629 +>>>>>>> Fixing the computation of the Word2Vec loss. * result += 1 * i += 1 * if i == MAX_SENTENCE_LEN: # <<<<<<<<<<<<<< @@ -7779,7 +9934,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":815 +======= + /* "gensim/models/word2vec_inner.pyx":619 +>>>>>>> Fixing the computation of the Word2Vec loss. * vlookup = model.wv.vocab * i = 0 * for token in sentence: # <<<<<<<<<<<<<< @@ -7791,7 +9950,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_L4_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":827 +======= + /* "gensim/models/word2vec_inner.pyx":631 +>>>>>>> Fixing the computation of the Word2Vec loss. * if i == MAX_SENTENCE_LEN: * break # TODO: log warning, tally overflow? * sentence_len = i # <<<<<<<<<<<<<< @@ -7800,7 +9963,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_sentence_len = __pyx_v_i; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":830 +======= + /* "gensim/models/word2vec_inner.pyx":634 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # release GIL & train on the sentence * c.work[0] = 0.0 # <<<<<<<<<<<<<< @@ -7809,7 +9976,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ (__pyx_v_c.work[0]) = 0.0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":831 +======= + /* "gensim/models/word2vec_inner.pyx":635 +>>>>>>> Fixing the computation of the Word2Vec loss. * # release GIL & train on the sentence * c.work[0] = 0.0 * with nogil: # <<<<<<<<<<<<<< @@ -7824,8 +9995,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( #endif /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":832 * c.work[0] = 0.0 +======= + /* "gensim/models/word2vec_inner.pyx":636 + * work[0] = 0.0 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for i in range(sentence_len): # <<<<<<<<<<<<<< * if c.codelens[i] == 0: @@ -7836,7 +10012,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":833 +======= + /* "gensim/models/word2vec_inner.pyx":637 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for i in range(sentence_len): * if c.codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7846,7 +10026,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = (((__pyx_v_c.codelens[__pyx_v_i]) == 0) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":834 +======= + /* "gensim/models/word2vec_inner.pyx":638 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(sentence_len): * if c.codelens[i] == 0: * continue # <<<<<<<<<<<<<< @@ -7855,7 +10039,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ goto __pyx_L10_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":833 +======= + /* "gensim/models/word2vec_inner.pyx":637 +>>>>>>> Fixing the computation of the Word2Vec loss. * with nogil: * for i in range(sentence_len): * if c.codelens[i] == 0: # <<<<<<<<<<<<<< @@ -7864,8 +10052,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":835 * if c.codelens[i] == 0: +======= + /* "gensim/models/word2vec_inner.pyx":639 + * if codelens[i] == 0: +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window # <<<<<<<<<<<<<< * if j < 0: @@ -7873,7 +10066,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_j = (__pyx_v_i - __pyx_v_c.window); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":836 +======= + /* "gensim/models/word2vec_inner.pyx":640 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window * if j < 0: # <<<<<<<<<<<<<< @@ -7883,8 +10080,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_j < 0) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":837 * j = i - c.window +======= + /* "gensim/models/word2vec_inner.pyx":641 + * j = i - window +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < 0: * j = 0 # <<<<<<<<<<<<<< * k = i + c.window + 1 @@ -7892,7 +10094,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_j = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":836 +======= + /* "gensim/models/word2vec_inner.pyx":640 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * j = i - c.window * if j < 0: # <<<<<<<<<<<<<< @@ -7901,7 +10107,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":838 +======= + /* "gensim/models/word2vec_inner.pyx":642 +>>>>>>> Fixing the computation of the Word2Vec loss. * if j < 0: * j = 0 * k = i + c.window + 1 # <<<<<<<<<<<<<< @@ -7910,7 +10120,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_k = ((__pyx_v_i + __pyx_v_c.window) + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":839 +======= + /* "gensim/models/word2vec_inner.pyx":643 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = 0 * k = i + c.window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7920,8 +10134,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( __pyx_t_8 = ((__pyx_v_k > __pyx_v_sentence_len) != 0); if (__pyx_t_8) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":840 * k = i + c.window + 1 +======= + /* "gensim/models/word2vec_inner.pyx":644 + * k = i + window + 1 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > sentence_len: * k = sentence_len # <<<<<<<<<<<<<< * score_pair_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.work, i, j, k, c.cbow_mean) @@ -7929,7 +10148,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ __pyx_v_k = __pyx_v_sentence_len; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":839 +======= + /* "gensim/models/word2vec_inner.pyx":643 +>>>>>>> Fixing the computation of the Word2Vec loss. * j = 0 * k = i + c.window + 1 * if k > sentence_len: # <<<<<<<<<<<<<< @@ -7938,7 +10161,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":841 +======= + /* "gensim/models/word2vec_inner.pyx":645 +>>>>>>> Fixing the computation of the Word2Vec loss. * if k > sentence_len: * k = sentence_len * score_pair_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.work, i, j, k, c.cbow_mean) # <<<<<<<<<<<<<< @@ -7950,7 +10177,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":831 +======= + /* "gensim/models/word2vec_inner.pyx":635 +>>>>>>> Fixing the computation of the Word2Vec loss. * # release GIL & train on the sentence * c.work[0] = 0.0 * with nogil: # <<<<<<<<<<<<<< @@ -7969,21 +10200,34 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( } } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":843 * score_pair_cbow_hs(c.points[i], c.codes[i], c.codelens, c.neu1, c.syn0, c.syn1, c.size, c.indexes, c.work, i, j, k, c.cbow_mean) +======= + /* "gensim/models/word2vec_inner.pyx":647 + * score_pair_cbow_hs(points[i], codes[i], codelens, neu1, syn0, syn1, size, indexes, work, i, j, k, cbow_mean) +>>>>>>> Fixing the computation of the Word2Vec loss. * * return c.work[0] # <<<<<<<<<<<<<< * * cdef void score_pair_cbow_hs( */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyFloat_FromDouble((__pyx_v_c.work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 843, __pyx_L1_error) +======= + __pyx_t_1 = PyFloat_FromDouble((__pyx_v_work[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":772 +======= + /* "gensim/models/word2vec_inner.pyx":589 +>>>>>>> Fixing the computation of the Word2Vec loss. * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< @@ -8007,8 +10251,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_6score_sentence_cbow( return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":845 * return c.work[0] +======= +/* "gensim/models/word2vec_inner.pyx":649 + * return work[0] +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef void score_pair_cbow_hs( # <<<<<<<<<<<<<< * const np.uint32_t *word_point, const np.uint8_t *word_code, int codelens[MAX_SENTENCE_LEN], @@ -8031,7 +10280,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ PY_LONG_LONG __pyx_t_6; long __pyx_t_7; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":856 +======= + /* "gensim/models/word2vec_inner.pyx":660 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int m * * memset(neu1, 0, size * cython.sizeof(REAL_t)) # <<<<<<<<<<<<<< @@ -8040,7 +10293,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ (void)(memset(__pyx_v_neu1, 0, (__pyx_v_size * (sizeof(__pyx_t_6gensim_6models_14word2vec_inner_REAL_t))))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":857 +======= + /* "gensim/models/word2vec_inner.pyx":661 +>>>>>>> Fixing the computation of the Word2Vec loss. * * memset(neu1, 0, size * cython.sizeof(REAL_t)) * count = 0.0 # <<<<<<<<<<<<<< @@ -8049,7 +10306,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_count = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":858 +======= + /* "gensim/models/word2vec_inner.pyx":662 +>>>>>>> Fixing the computation of the Word2Vec loss. * memset(neu1, 0, size * cython.sizeof(REAL_t)) * count = 0.0 * for m in range(j, k): # <<<<<<<<<<<<<< @@ -8061,7 +10322,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ for (__pyx_t_3 = __pyx_v_j; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_m = __pyx_t_3; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":859 +======= + /* "gensim/models/word2vec_inner.pyx":663 +>>>>>>> Fixing the computation of the Word2Vec loss. * count = 0.0 * for m in range(j, k): * if m == i or codelens[m] == 0: # <<<<<<<<<<<<<< @@ -8079,7 +10344,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_L6_bool_binop_done:; if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":860 +======= + /* "gensim/models/word2vec_inner.pyx":664 +>>>>>>> Fixing the computation of the Word2Vec loss. * for m in range(j, k): * if m == i or codelens[m] == 0: * continue # <<<<<<<<<<<<<< @@ -8088,7 +10357,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ goto __pyx_L3_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":859 +======= + /* "gensim/models/word2vec_inner.pyx":663 +>>>>>>> Fixing the computation of the Word2Vec loss. * count = 0.0 * for m in range(j, k): * if m == i or codelens[m] == 0: # <<<<<<<<<<<<<< @@ -8097,7 +10370,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":862 +======= + /* "gensim/models/word2vec_inner.pyx":666 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * else: * count += ONEF # <<<<<<<<<<<<<< @@ -8107,7 +10384,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ /*else*/ { __pyx_v_count = (__pyx_v_count + __pyx_v_6gensim_6models_14word2vec_inner_ONEF); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":863 +======= + /* "gensim/models/word2vec_inner.pyx":667 +>>>>>>> Fixing the computation of the Word2Vec loss. * else: * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) # <<<<<<<<<<<<<< @@ -8119,7 +10400,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_L3_continue:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":864 +======= + /* "gensim/models/word2vec_inner.pyx":668 +>>>>>>> Fixing the computation of the Word2Vec loss. * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): # <<<<<<<<<<<<<< @@ -8129,7 +10414,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_t_4 = ((__pyx_v_count > ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0.5)) != 0); if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":865 +======= + /* "gensim/models/word2vec_inner.pyx":669 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): * inv_count = ONEF/count # <<<<<<<<<<<<<< @@ -8138,7 +10427,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_inv_count = (__pyx_v_6gensim_6models_14word2vec_inner_ONEF / __pyx_v_count); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":864 +======= + /* "gensim/models/word2vec_inner.pyx":668 +>>>>>>> Fixing the computation of the Word2Vec loss. * count += ONEF * our_saxpy(&size, &ONEF, &syn0[indexes[m] * size], &ONE, neu1, &ONE) * if count > (0.5): # <<<<<<<<<<<<<< @@ -8147,7 +10440,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":866 +======= + /* "gensim/models/word2vec_inner.pyx":670 +>>>>>>> Fixing the computation of the Word2Vec loss. * if count > (0.5): * inv_count = ONEF/count * if cbow_mean: # <<<<<<<<<<<<<< @@ -8157,7 +10454,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_t_4 = (__pyx_v_cbow_mean != 0); if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":867 +======= + /* "gensim/models/word2vec_inner.pyx":671 +>>>>>>> Fixing the computation of the Word2Vec loss. * inv_count = ONEF/count * if cbow_mean: * sscal(&size, &inv_count, neu1, &ONE) # <<<<<<<<<<<<<< @@ -8166,7 +10467,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_6gensim_6models_14word2vec_inner_sscal((&__pyx_v_size), (&__pyx_v_inv_count), __pyx_v_neu1, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":866 +======= + /* "gensim/models/word2vec_inner.pyx":670 +>>>>>>> Fixing the computation of the Word2Vec loss. * if count > (0.5): * inv_count = ONEF/count * if cbow_mean: # <<<<<<<<<<<<<< @@ -8175,7 +10480,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":869 +======= + /* "gensim/models/word2vec_inner.pyx":673 +>>>>>>> Fixing the computation of the Word2Vec loss. * sscal(&size, &inv_count, neu1, &ONE) * * for b in range(codelens[i]): # <<<<<<<<<<<<<< @@ -8187,7 +10496,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { __pyx_v_b = __pyx_t_6; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":870 +======= + /* "gensim/models/word2vec_inner.pyx":674 +>>>>>>> Fixing the computation of the Word2Vec loss. * * for b in range(codelens[i]): * row2 = word_point[b] * size # <<<<<<<<<<<<<< @@ -8196,7 +10509,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_row2 = ((__pyx_v_word_point[__pyx_v_b]) * __pyx_v_size); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":871 +======= + /* "gensim/models/word2vec_inner.pyx":675 +>>>>>>> Fixing the computation of the Word2Vec loss. * for b in range(codelens[i]): * row2 = word_point[b] * size * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) # <<<<<<<<<<<<<< @@ -8205,7 +10522,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = __pyx_v_6gensim_6models_14word2vec_inner_our_dot((&__pyx_v_size), __pyx_v_neu1, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), (&(__pyx_v_syn1[__pyx_v_row2])), (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":872 +======= + /* "gensim/models/word2vec_inner.pyx":676 +>>>>>>> Fixing the computation of the Word2Vec loss. * row2 = word_point[b] * size * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 # <<<<<<<<<<<<<< @@ -8214,7 +10535,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_sgn = __Pyx_pow_long(-1L, ((long)(__pyx_v_word_code[__pyx_v_b]))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":873 +======= + /* "gensim/models/word2vec_inner.pyx":677 +>>>>>>> Fixing the computation of the Word2Vec loss. * f = our_dot(&size, neu1, &ONE, &syn1[row2], &ONE) * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn # <<<<<<<<<<<<<< @@ -8223,7 +10548,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = (__pyx_v_f * __pyx_v_sgn); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":874 +======= + /* "gensim/models/word2vec_inner.pyx":678 +>>>>>>> Fixing the computation of the Word2Vec loss. * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -8241,7 +10570,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_L13_bool_binop_done:; if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":875 +======= + /* "gensim/models/word2vec_inner.pyx":679 +>>>>>>> Fixing the computation of the Word2Vec loss. * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: * continue # <<<<<<<<<<<<<< @@ -8250,7 +10583,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ goto __pyx_L10_continue; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":874 +======= + /* "gensim/models/word2vec_inner.pyx":678 +>>>>>>> Fixing the computation of the Word2Vec loss. * sgn = (-1)**word_code[b] # ch function: 0-> 1, 1 -> -1 * f *= sgn * if f <= -MAX_EXP or f >= MAX_EXP: # <<<<<<<<<<<<<< @@ -8259,7 +10596,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":876 +======= + /* "gensim/models/word2vec_inner.pyx":680 +>>>>>>> Fixing the computation of the Word2Vec loss. * if f <= -MAX_EXP or f >= MAX_EXP: * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] # <<<<<<<<<<<<<< @@ -8268,7 +10609,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ */ __pyx_v_f = (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[((int)((__pyx_v_f + 6.0) * 83.0))]); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":877 +======= + /* "gensim/models/word2vec_inner.pyx":681 +>>>>>>> Fixing the computation of the Word2Vec loss. * continue * f = LOG_TABLE[((f + MAX_EXP) * (EXP_TABLE_SIZE / MAX_EXP / 2))] * work[0] += f # <<<<<<<<<<<<<< @@ -8280,8 +10625,13 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ __pyx_L10_continue:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":845 * return c.work[0] +======= + /* "gensim/models/word2vec_inner.pyx":649 + * return work[0] +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef void score_pair_cbow_hs( # <<<<<<<<<<<<<< * const np.uint32_t *word_point, const np.uint8_t *word_code, int codelens[MAX_SENTENCE_LEN], @@ -8291,7 +10641,11 @@ static void __pyx_f_6gensim_6models_14word2vec_inner_score_pair_cbow_hs(__pyx_t_ /* function exit code */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":880 +======= +/* "gensim/models/word2vec_inner.pyx":684 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def init(): # <<<<<<<<<<<<<< @@ -8330,7 +10684,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P int __pyx_t_4; __Pyx_RefNannySetupContext("init", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":896 +======= + /* "gensim/models/word2vec_inner.pyx":694 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef int i * cdef float *x = [10.0] # <<<<<<<<<<<<<< @@ -8340,7 +10698,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_1[0] = ((float)10.0); __pyx_v_x = __pyx_t_1; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":897 +======= + /* "gensim/models/word2vec_inner.pyx":695 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int i * cdef float *x = [10.0] * cdef float *y = [0.01] # <<<<<<<<<<<<<< @@ -8350,7 +10712,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_2[0] = ((float)0.01); __pyx_v_y = __pyx_t_2; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":898 +======= + /* "gensim/models/word2vec_inner.pyx":696 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef float *x = [10.0] * cdef float *y = [0.01] * cdef float expected = 0.1 # <<<<<<<<<<<<<< @@ -8359,7 +10725,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_expected = ((float)0.1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":899 +======= + /* "gensim/models/word2vec_inner.pyx":697 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef float *y = [0.01] * cdef float expected = 0.1 * cdef int size = 1 # <<<<<<<<<<<<<< @@ -8368,7 +10738,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_size = 1; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":904 +======= + /* "gensim/models/word2vec_inner.pyx":702 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # build the sigmoid table * for i in range(EXP_TABLE_SIZE): # <<<<<<<<<<<<<< @@ -8378,7 +10752,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P for (__pyx_t_3 = 0; __pyx_t_3 < 0x3E8; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":905 +======= + /* "gensim/models/word2vec_inner.pyx":703 +>>>>>>> Fixing the computation of the Word2Vec loss. * # build the sigmoid table * for i in range(EXP_TABLE_SIZE): * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) # <<<<<<<<<<<<<< @@ -8387,7 +10765,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ (__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)exp(((((__pyx_v_i / ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)0x3E8)) * 2.0) - 1.0) * 6.0))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":906 +======= + /* "gensim/models/word2vec_inner.pyx":704 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(EXP_TABLE_SIZE): * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) * EXP_TABLE[i] = (EXP_TABLE[i] / (EXP_TABLE[i] + 1)) # <<<<<<<<<<<<<< @@ -8396,7 +10778,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ (__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) / ((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]) + 1.0))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":907 +======= + /* "gensim/models/word2vec_inner.pyx":705 +>>>>>>> Fixing the computation of the Word2Vec loss. * EXP_TABLE[i] = exp((i / EXP_TABLE_SIZE * 2 - 1) * MAX_EXP) * EXP_TABLE[i] = (EXP_TABLE[i] / (EXP_TABLE[i] + 1)) * LOG_TABLE[i] = log( EXP_TABLE[i] ) # <<<<<<<<<<<<<< @@ -8406,7 +10792,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P (__pyx_v_6gensim_6models_14word2vec_inner_LOG_TABLE[__pyx_v_i]) = ((__pyx_t_6gensim_6models_14word2vec_inner_REAL_t)log((__pyx_v_6gensim_6models_14word2vec_inner_EXP_TABLE[__pyx_v_i]))); } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":910 +======= + /* "gensim/models/word2vec_inner.pyx":708 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # check whether sdot returns double or float * d_res = dsdot(&size, x, &ONE, y, &ONE) # <<<<<<<<<<<<<< @@ -8415,7 +10805,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_d_res = __pyx_v_6gensim_6models_14word2vec_inner_dsdot((&__pyx_v_size), __pyx_v_x, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE), __pyx_v_y, (&__pyx_v_6gensim_6models_14word2vec_inner_ONE)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":911 +======= + /* "gensim/models/word2vec_inner.pyx":709 +>>>>>>> Fixing the computation of the Word2Vec loss. * # check whether sdot returns double or float * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res # <<<<<<<<<<<<<< @@ -8424,7 +10818,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_p_res = ((float *)(&__pyx_v_d_res)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":912 +======= + /* "gensim/models/word2vec_inner.pyx":710 +>>>>>>> Fixing the computation of the Word2Vec loss. * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res * if abs(d_res - expected) < 0.0001: # <<<<<<<<<<<<<< @@ -8434,7 +10832,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_4 = ((fabs((__pyx_v_d_res - __pyx_v_expected)) < 0.0001) != 0); if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":913 +======= + /* "gensim/models/word2vec_inner.pyx":711 +>>>>>>> Fixing the computation of the Word2Vec loss. * p_res = &d_res * if abs(d_res - expected) < 0.0001: * our_dot = our_dot_double # <<<<<<<<<<<<<< @@ -8443,8 +10845,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_double; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":914 * if abs(d_res - expected) < 0.0001: +======= + /* "gensim/models/word2vec_inner.pyx":712 + * if (abs(d_res - expected) < 0.0001): +>>>>>>> Fixing the computation of the Word2Vec loss. * our_dot = our_dot_double * our_saxpy = saxpy # <<<<<<<<<<<<<< * return 0 # double @@ -8452,7 +10859,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_v_6gensim_6models_14word2vec_inner_saxpy; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":915 +======= + /* "gensim/models/word2vec_inner.pyx":713 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_dot = our_dot_double * our_saxpy = saxpy * return 0 # double # <<<<<<<<<<<<<< @@ -8464,7 +10875,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_r = __pyx_int_0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":912 +======= + /* "gensim/models/word2vec_inner.pyx":710 +>>>>>>> Fixing the computation of the Word2Vec loss. * d_res = dsdot(&size, x, &ONE, y, &ONE) * p_res = &d_res * if abs(d_res - expected) < 0.0001: # <<<<<<<<<<<<<< @@ -8473,7 +10888,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":916 +======= + /* "gensim/models/word2vec_inner.pyx":714 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_saxpy = saxpy * return 0 # double * elif abs(p_res[0] - expected) < 0.0001: # <<<<<<<<<<<<<< @@ -8483,7 +10902,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_t_4 = ((fabsf(((__pyx_v_p_res[0]) - __pyx_v_expected)) < 0.0001) != 0); if (__pyx_t_4) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":917 +======= + /* "gensim/models/word2vec_inner.pyx":715 +>>>>>>> Fixing the computation of the Word2Vec loss. * return 0 # double * elif abs(p_res[0] - expected) < 0.0001: * our_dot = our_dot_float # <<<<<<<<<<<<<< @@ -8492,8 +10915,13 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_float; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":918 * elif abs(p_res[0] - expected) < 0.0001: +======= + /* "gensim/models/word2vec_inner.pyx":716 + * elif (abs(p_res[0] - expected) < 0.0001): +>>>>>>> Fixing the computation of the Word2Vec loss. * our_dot = our_dot_float * our_saxpy = saxpy # <<<<<<<<<<<<<< * return 1 # float @@ -8501,7 +10929,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_v_6gensim_6models_14word2vec_inner_saxpy; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":919 +======= + /* "gensim/models/word2vec_inner.pyx":717 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_dot = our_dot_float * our_saxpy = saxpy * return 1 # float # <<<<<<<<<<<<<< @@ -8513,7 +10945,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P __pyx_r = __pyx_int_1; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":916 +======= + /* "gensim/models/word2vec_inner.pyx":714 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_saxpy = saxpy * return 0 # double * elif abs(p_res[0] - expected) < 0.0001: # <<<<<<<<<<<<<< @@ -8522,7 +10958,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":923 +======= + /* "gensim/models/word2vec_inner.pyx":721 +>>>>>>> Fixing the computation of the Word2Vec loss. * # neither => use cython loops, no BLAS * # actually, the BLAS is so messed up we'll probably have segfaulted above and never even reach here * our_dot = our_dot_noblas # <<<<<<<<<<<<<< @@ -8532,7 +10972,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P /*else*/ { __pyx_v_6gensim_6models_14word2vec_inner_our_dot = __pyx_f_6gensim_6models_14word2vec_inner_our_dot_noblas; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":924 +======= + /* "gensim/models/word2vec_inner.pyx":722 +>>>>>>> Fixing the computation of the Word2Vec loss. * # actually, the BLAS is so messed up we'll probably have segfaulted above and never even reach here * our_dot = our_dot_noblas * our_saxpy = our_saxpy_noblas # <<<<<<<<<<<<<< @@ -8541,7 +10985,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P */ __pyx_v_6gensim_6models_14word2vec_inner_our_saxpy = __pyx_f_6gensim_6models_14word2vec_inner_our_saxpy_noblas; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":925 +======= + /* "gensim/models/word2vec_inner.pyx":723 +>>>>>>> Fixing the computation of the Word2Vec loss. * our_dot = our_dot_noblas * our_saxpy = our_saxpy_noblas * return 2 # <<<<<<<<<<<<<< @@ -8554,7 +11002,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P goto __pyx_L0; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":880 +======= + /* "gensim/models/word2vec_inner.pyx":684 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def init(): # <<<<<<<<<<<<<< @@ -8569,7 +11021,11 @@ static PyObject *__pyx_pf_6gensim_6models_14word2vec_inner_8init(CYTHON_UNUSED P return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215 +>>>>>>> Fixing the computation of the Word2Vec loss. * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -8607,9 +11063,14 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 PyArray_Descr *__pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; +======= + PyObject *__pyx_t_7 = NULL; + char *__pyx_t_8; +>>>>>>> Fixing the computation of the Word2Vec loss. if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -8618,7 +11079,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef int i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -8627,7 +11092,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":223 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -8636,7 +11105,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -8645,7 +11118,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 +>>>>>>> Fixing the computation of the Word2Vec loss. * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8659,7 +11136,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L4_bool_binop_done; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":228 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -8670,7 +11151,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 +>>>>>>> Fixing the computation of the Word2Vec loss. * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8679,13 +11164,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (unlikely(__pyx_t_1)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); @@ -8693,6 +11183,15 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __PYX_ERR(1, 272, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 +======= + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 229, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":227 +>>>>>>> Fixing the computation of the Word2Vec loss. * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8701,7 +11200,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8715,7 +11218,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L7_bool_binop_done; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -8726,7 +11233,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = __pyx_t_2; __pyx_L7_bool_binop_done:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8735,13 +11246,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (unlikely(__pyx_t_1)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); @@ -8749,6 +11265,15 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __PYX_ERR(1, 276, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 +======= + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 233, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8757,7 +11282,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -8766,7 +11295,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236 +>>>>>>> Fixing the computation of the Word2Vec loss. * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -8775,7 +11308,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -8785,7 +11322,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":240 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< @@ -8794,7 +11335,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":241 +>>>>>>> Fixing the computation of the Word2Vec loss. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -8803,7 +11348,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -8815,7 +11364,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -8824,7 +11377,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":244 +>>>>>>> Fixing the computation of the Word2Vec loss. * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -8834,7 +11391,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -8844,7 +11405,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L9; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -8854,7 +11419,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":247 +>>>>>>> Fixing the computation of the Word2Vec loss. * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -8865,7 +11434,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L9:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -8874,7 +11447,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":249 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -8883,7 +11460,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -8892,7 +11473,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -8901,7 +11486,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":254 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int t * cdef char* f = NULL * cdef dtype descr = PyArray_DESCR(self) # <<<<<<<<<<<<<< @@ -8914,7 +11503,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":300 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef int offset * * info.obj = self # <<<<<<<<<<<<<< @@ -8927,7 +11520,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":302 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -8937,7 +11534,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); if (__pyx_t_1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":303 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if not PyDataType_HASFIELDS(descr): * t = descr.type_num # <<<<<<<<<<<<<< @@ -8947,7 +11548,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -8967,7 +11572,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L15_next_or:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":305 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262 +>>>>>>> Fixing the computation of the Word2Vec loss. * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -8984,7 +11593,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = __pyx_t_2; __pyx_L14_bool_binop_done:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -8993,13 +11606,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (unlikely(__pyx_t_1)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":306 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); @@ -9007,6 +11625,15 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __PYX_ERR(1, 306, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":304 +======= + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 263, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -9015,7 +11642,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":307 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264 +>>>>>>> Fixing the computation of the Word2Vec loss. * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -9028,7 +11659,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_UBYTE: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":308 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -9039,7 +11674,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_SHORT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":309 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266 +>>>>>>> Fixing the computation of the Word2Vec loss. * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -9050,7 +11689,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_USHORT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":310 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -9061,7 +11704,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_INT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":311 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -9072,7 +11719,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_UINT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":312 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -9083,7 +11734,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_LONG: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":313 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -9094,7 +11749,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_ULONG: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":314 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -9105,7 +11764,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_LONGLONG: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":315 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -9116,7 +11779,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_ULONGLONG: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":316 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -9127,7 +11794,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_FLOAT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":317 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -9138,7 +11809,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_DOUBLE: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":318 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -9149,7 +11824,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_LONGDOUBLE: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":319 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -9160,7 +11839,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_CFLOAT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":320 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":277 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -9171,7 +11854,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_CDOUBLE: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":321 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -9182,7 +11869,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_CLONGDOUBLE: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":322 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -9193,7 +11884,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; case NPY_OBJECT: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":323 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -9204,13 +11899,18 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P break; default: +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":325 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error) @@ -9226,6 +11926,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":326 +======= + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 282, __pyx_L1_error) + break; + } + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283 +>>>>>>> Fixing the computation of the Word2Vec loss. * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -9234,7 +11951,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":327 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -9244,7 +11965,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_r = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":302 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -9253,7 +11978,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":329 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":286 +>>>>>>> Fixing the computation of the Word2Vec loss. * return * else: * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -9263,7 +11992,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":330 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":287 +>>>>>>> Fixing the computation of the Word2Vec loss. * else: * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -9272,7 +12005,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":331 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -9281,17 +12018,28 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":332 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":289 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, * &offset) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error) __pyx_v_f = __pyx_t_9; /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":335 +======= + __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error) + __pyx_v_f = __pyx_t_8; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292 +>>>>>>> Fixing the computation of the Word2Vec loss. * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -9301,7 +12049,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_f[0]) = '\x00'; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":215 +>>>>>>> Fixing the computation of the Word2Vec loss. * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -9314,7 +12066,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_XDECREF(__pyx_t_8); +======= + __Pyx_XDECREF(__pyx_t_7); +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { @@ -9333,7 +12089,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":337 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294 +>>>>>>> Fixing the computation of the Word2Vec loss. * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -9357,7 +12117,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":338 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -9367,7 +12131,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":339 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":296 +>>>>>>> Fixing the computation of the Word2Vec loss. * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) # <<<<<<<<<<<<<< @@ -9376,7 +12144,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->format); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":338 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":295 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -9385,7 +12157,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":340 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 +>>>>>>> Fixing the computation of the Word2Vec loss. * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9395,7 +12171,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":341 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":298 +>>>>>>> Fixing the computation of the Word2Vec loss. * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) # <<<<<<<<<<<<<< @@ -9404,7 +12184,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->strides); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":340 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":297 +>>>>>>> Fixing the computation of the Word2Vec loss. * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9413,7 +12197,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":337 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294 +>>>>>>> Fixing the computation of the Word2Vec loss. * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -9425,7 +12213,11 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9439,7 +12231,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -9447,13 +12243,21 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error) +======= + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":775 +>>>>>>> Fixing the computation of the Word2Vec loss. * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9472,7 +12276,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9486,7 +12294,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -9494,13 +12306,21 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) +======= + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":778 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9519,7 +12339,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -9533,7 +12357,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -9541,13 +12369,21 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error) +======= + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":781 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -9566,7 +12402,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -9580,7 +12420,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -9588,13 +12432,21 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error) +======= + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":784 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -9613,7 +12465,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -9627,7 +12483,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":788 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -9635,13 +12495,21 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error) +======= + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":787 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -9660,7 +12528,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -9674,7 +12546,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -9684,7 +12560,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":792 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -9696,7 +12576,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -9705,7 +12589,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794 +>>>>>>> Fixing the computation of the Word2Vec loss. * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -9719,7 +12607,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790 +>>>>>>> Fixing the computation of the Word2Vec loss. * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -9734,7 +12626,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796 +>>>>>>> Fixing the computation of the Word2Vec loss. * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -9763,7 +12659,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -9772,7 +12672,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -9781,7 +12685,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -9790,21 +12698,35 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_ERR(1, 851, __pyx_L1_error) +======= + __PYX_ERR(1, 805, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) +======= + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":806 +>>>>>>> Fixing the computation of the Word2Vec loss. * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -9813,6 +12735,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_ERR(1, 852, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) @@ -9822,6 +12745,17 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = 0; /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853 +======= + __PYX_ERR(1, 806, __pyx_L1_error) + } + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":807 +>>>>>>> Fixing the computation of the Word2Vec loss. * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -9834,7 +12768,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_ERR(1, 853, __pyx_L1_error) +======= + __PYX_ERR(1, 807, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -9842,6 +12780,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) @@ -9851,35 +12790,64 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error) } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error) +======= + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error) + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 +>>>>>>> Fixing the computation of the Word2Vec loss. * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); if (unlikely(__pyx_t_6)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); @@ -9887,6 +12855,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __PYX_ERR(1, 856, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855 +======= + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 810, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":809 +>>>>>>> Fixing the computation of the Word2Vec loss. * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -9895,7 +12872,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -9915,7 +12896,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L8_next_or:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":859 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -9932,7 +12917,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -9941,13 +12930,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_t_6)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); @@ -9955,6 +12949,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __PYX_ERR(1, 860, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":858 +======= + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 814, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":812 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -9963,7 +12966,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":870 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":824 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -9971,6 +12978,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error) @@ -9980,6 +12988,17 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (!__pyx_t_6) break; /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":871 +======= + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_6) break; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":825 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -9988,7 +13007,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 0x78; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":872 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826 +>>>>>>> Fixing the computation of the Word2Vec loss. * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -9997,7 +13020,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":873 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827 +>>>>>>> Fixing the computation of the Word2Vec loss. * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -10008,7 +13035,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":875 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829 +>>>>>>> Fixing the computation of the Word2Vec loss. * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -10018,7 +13049,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":877 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 +>>>>>>> Fixing the computation of the Word2Vec loss. * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -10028,19 +13063,31 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":878 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":879 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -10050,13 +13097,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (unlikely(__pyx_t_6)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":880 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 +>>>>>>> Fixing the computation of the Word2Vec loss. * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); @@ -10064,6 +13116,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __PYX_ERR(1, 880, __pyx_L1_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":879 +======= + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 834, __pyx_L1_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833 +>>>>>>> Fixing the computation of the Word2Vec loss. * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -10072,252 +13133,420 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":883 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837 +>>>>>>> Fixing the computation of the Word2Vec loss. * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":884 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":885 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839 +>>>>>>> Fixing the computation of the Word2Vec loss. * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":886 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":887 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":888 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":889 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":843 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 843, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 843, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":890 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":891 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 845, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 845, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":892 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":846 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 846, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":893 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":847 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 847, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 847, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":894 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":848 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 848, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":895 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 849, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 849, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":896 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10326,18 +13555,30 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":897 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10346,18 +13587,30 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":898 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":852 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error) +======= + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -10366,25 +13619,41 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":899 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":853 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error) +======= + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_6)) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":901 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":855 +>>>>>>> Fixing the computation of the Word2Vec loss. * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -10392,18 +13661,32 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * else: */ /*else*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error) +======= + __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_ERR(1, 901, __pyx_L1_error) } __pyx_L15:; /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":902 +======= + __PYX_ERR(1, 855, __pyx_L1_error) + } + __pyx_L15:; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856 +>>>>>>> Fixing the computation of the Word2Vec loss. * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -10412,7 +13695,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":877 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831 +>>>>>>> Fixing the computation of the Word2Vec loss. * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -10422,7 +13709,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":906 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":860 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -10430,12 +13721,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * */ /*else*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error) +======= + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __pyx_v_f = __pyx_t_9; } __pyx_L13:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":851 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":805 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -10445,7 +13744,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":907 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":861 +>>>>>>> Fixing the computation of the Word2Vec loss. * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -10455,7 +13758,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796 +>>>>>>> Fixing the computation of the Word2Vec loss. * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -10480,8 +13787,13 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022 * int _import_umath() except -1 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977 + * +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * Py_INCREF(base) # important to do this before stealing the reference below! @@ -10492,26 +13804,97 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_array_base", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1023 * * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< * PyArray_SetBaseObject(arr, base) +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":979 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + goto __pyx_L3; + } + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":982 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + /*else*/ { + Py_INCREF(__pyx_v_base); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":983 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":984 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr +>>>>>>> Fixing the computation of the Word2Vec loss. * */ Py_INCREF(__pyx_v_base); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1024 * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object get_array_base(ndarray arr): */ (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1022 * int _import_umath() except -1 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977 + * +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * Py_INCREF(base) # important to do this before stealing the reference below! @@ -10522,8 +13905,13 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026 * PyArray_SetBaseObject(arr, base) +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987 + * arr.base = baseptr +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * base = PyArray_BASE(arr) @@ -10537,7 +13925,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1027 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< @@ -10546,7 +13938,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ __pyx_v_base = PyArray_BASE(__pyx_v_arr); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -10567,7 +13963,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1028 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988 + * +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -10576,8 +13977,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1030 * if base is NULL: +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991 +>>>>>>> Fixing the computation of the Word2Vec loss. * return None * return base # <<<<<<<<<<<<<< * @@ -10588,8 +13993,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1026 * PyArray_SetBaseObject(arr, base) +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987 + * arr.base = baseptr +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * base = PyArray_BASE(arr) @@ -10603,7 +14013,11 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -10624,7 +14038,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10640,16 +14058,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1036 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035 +======= + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10663,7 +14091,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1037 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999 +>>>>>>> Fixing the computation of the Word2Vec loss. * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< @@ -10673,28 +14105,48 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error) +======= + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 +>>>>>>> Fixing the computation of the Word2Vec loss. * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1038, __pyx_L5_except_error) +======= + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1000, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } goto __pyx_L5_except_error; __pyx_L5_except_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1035 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -10709,7 +14161,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1034 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":996 +>>>>>>> Fixing the computation of the Word2Vec loss. * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -10732,7 +14188,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -10753,7 +14213,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -10769,16 +14233,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1042 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1004 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041 +======= + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -10792,7 +14266,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1043 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1005 +>>>>>>> Fixing the computation of the Word2Vec loss. * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -10802,28 +14280,48 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error) +======= + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006 +>>>>>>> Fixing the computation of the Word2Vec loss. * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1044, __pyx_L5_except_error) +======= + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1006, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } goto __pyx_L5_except_error; __pyx_L5_except_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1041 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1003 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -10838,7 +14336,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1040 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1002 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -10861,7 +14363,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046 +======= +/* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -10882,7 +14388,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -10898,16 +14408,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1048 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1010 +>>>>>>> Fixing the computation of the Word2Vec loss. * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error) /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047 +======= + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error) + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -10921,7 +14441,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1049 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1011 +>>>>>>> Fixing the computation of the Word2Vec loss. * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -10930,26 +14454,46 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error) +======= + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1050 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012 +>>>>>>> Fixing the computation of the Word2Vec loss. * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(1, 1050, __pyx_L5_except_error) +======= + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __PYX_ERR(1, 1012, __pyx_L5_except_error) +>>>>>>> Fixing the computation of the Word2Vec loss. } goto __pyx_L5_except_error; __pyx_L5_except_error:; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1047 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1009 +>>>>>>> Fixing the computation of the Word2Vec loss. * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -10964,7 +14508,11 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -11054,6 +14602,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_cum_table, __pyx_k_cum_table, sizeof(__pyx_k_cum_table), 0, 0, 1, 1}, {&__pyx_n_s_d_res, __pyx_k_d_res, sizeof(__pyx_k_d_res), 0, 0, 1, 1}, {&__pyx_n_s_dsdot, __pyx_k_dsdot, sizeof(__pyx_k_dsdot), 0, 0, 1, 1}, + {&__pyx_n_s_effective_samples, __pyx_k_effective_samples, sizeof(__pyx_k_effective_samples), 0, 0, 1, 1}, {&__pyx_n_s_effective_sentences, __pyx_k_effective_sentences, sizeof(__pyx_k_effective_sentences), 0, 0, 1, 1}, {&__pyx_n_s_effective_words, __pyx_k_effective_words, sizeof(__pyx_k_effective_words), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, @@ -11061,7 +14610,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_fblas, __pyx_k_fblas, sizeof(__pyx_k_fblas), 0, 0, 1, 1}, {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, {&__pyx_n_s_gensim_models_word2vec_inner, __pyx_k_gensim_models_word2vec_inner, sizeof(__pyx_k_gensim_models_word2vec_inner), 0, 0, 1, 1}, - {&__pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_k_gensim_models_word2vec_inner_pyx, sizeof(__pyx_k_gensim_models_word2vec_inner_pyx), 0, 0, 1, 0}, {&__pyx_n_s_hs, __pyx_k_hs, sizeof(__pyx_k_hs), 0, 0, 1, 1}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_idx_end, __pyx_k_idx_end, sizeof(__pyx_k_idx_end), 0, 0, 1, 1}, @@ -11074,7 +14622,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_model, __pyx_k_model, sizeof(__pyx_k_model), 0, 0, 1, 1}, +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, +======= + {&__pyx_kp_s_models_word2vec_inner_pyx, __pyx_k_models_word2vec_inner_pyx, sizeof(__pyx_k_models_word2vec_inner_pyx), 0, 0, 1, 0}, +>>>>>>> Fixing the computation of the Word2Vec loss. {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_negative, __pyx_k_negative, sizeof(__pyx_k_negative), 0, 0, 1, 1}, @@ -11093,6 +14645,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, {&__pyx_n_s_running_training_loss, __pyx_k_running_training_loss, sizeof(__pyx_k_running_training_loss), 0, 0, 1, 1}, +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= + {&__pyx_n_s_running_training_loss_2, __pyx_k_running_training_loss_2, sizeof(__pyx_k_running_training_loss_2), 0, 0, 1, 1}, + {&__pyx_n_s_running_training_loss_sample, __pyx_k_running_training_loss_sample, sizeof(__pyx_k_running_training_loss_sample), 0, 0, 1, 1}, +>>>>>>> Fixing the computation of the Word2Vec loss. {&__pyx_n_s_sample, __pyx_k_sample, sizeof(__pyx_k_sample), 0, 0, 1, 1}, {&__pyx_n_s_sample_int, __pyx_k_sample_int, sizeof(__pyx_k_sample_int), 0, 0, 1, 1}, {&__pyx_n_s_saxpy, __pyx_k_saxpy, sizeof(__pyx_k_saxpy), 0, 0, 1, 1}, @@ -11132,12 +14689,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 25, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 564, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) +======= +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 376, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. return 0; __pyx_L1_error:; return -1; @@ -11157,83 +14723,179 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272 +======= + __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 340, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "gensim/models/word2vec_inner.pyx":449 + * cum_table_len = len(model.vocabulary.cum_table) + * if negative or sample: + * next_random = (2**24) * model.random.randint(0, 2**24) + model.random.randint(0, 2**24) # <<<<<<<<<<<<<< + * + * # convert Python structures to primitive types, so we can release the GIL + */ + __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_16777216); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276 +======= + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 229, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":306 +======= + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263 +>>>>>>> Fixing the computation of the Word2Vec loss. * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":856 +======= + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":810 +>>>>>>> Fixing the computation of the Word2Vec loss. * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":880 +======= + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 814, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834 +>>>>>>> Fixing the computation of the Word2Vec loss. * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1038 +======= + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 834, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000 +>>>>>>> Fixing the computation of the Word2Vec loss. * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1044 +======= + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1006 +>>>>>>> Fixing the computation of the Word2Vec loss. * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); +======= + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1012 + * _import_umath() + * except Exception: + * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1012, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); +>>>>>>> Fixing the computation of the Word2Vec loss. /* "gensim/models/word2vec_inner.pyx":500 * @@ -11242,18 +14904,28 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * """Update skip-gram model by training on a batch of sentences. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__10 = PyTuple_Pack(19, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_compute_loss, __pyx_n_s_c, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(5, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_train_batch_sg, 500, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 500, __pyx_L1_error) /* "gensim/models/word2vec_inner.pyx":591 +======= + __pyx_tuple__15 = PyTuple_Pack(42, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_effective_samples, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item, __pyx_n_s_running_training_loss_sample); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 296, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(5, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_train_batch_sg, 296, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 296, __pyx_L1_error) + + /* "gensim/models/word2vec_inner.pyx":404 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< * """Update CBOW model by training on a batch of sentences. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__12 = PyTuple_Pack(20, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_compute_loss, __pyx_n_s_c, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); @@ -11261,39 +14933,72 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "gensim/models/word2vec_inner.pyx":679 * +======= + __pyx_tuple__17 = PyTuple_Pack(43, __pyx_n_s_model, __pyx_n_s_sentences, __pyx_n_s_alpha, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_compute_loss, __pyx_n_s_hs, __pyx_n_s_negative, __pyx_n_s_sample, __pyx_n_s_cbow_mean, __pyx_n_s_compute_loss_2, __pyx_n_s_running_training_loss_2, __pyx_n_s_syn0, __pyx_n_s_word_locks, __pyx_n_s_work_2, __pyx_n_s_alpha_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_reduced_windows, __pyx_n_s_sentence_idx, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_effective_words, __pyx_n_s_effective_sentences, __pyx_n_s_sent_idx, __pyx_n_s_idx_start, __pyx_n_s_idx_end, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_syn1neg, __pyx_n_s_cum_table, __pyx_n_s_cum_table_len, __pyx_n_s_next_random, __pyx_n_s_neu1_2, __pyx_n_s_vlookup, __pyx_n_s_sent, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_item); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(6, 0, 43, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_train_batch_cbow, 404, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 404, __pyx_L1_error) + + /* "gensim/models/word2vec_inner.pyx":511 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted skip-gram representation. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__14 = PyTuple_Pack(12, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_c, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_sentence_len, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_sg, 679, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 679, __pyx_L1_error) /* "gensim/models/word2vec_inner.pyx":772 +======= + __pyx_tuple__19 = PyTuple_Pack(20, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_sg, 511, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 511, __pyx_L1_error) + + /* "gensim/models/word2vec_inner.pyx":589 +>>>>>>> Fixing the computation of the Word2Vec loss. * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted CBOW representation. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__16 = PyTuple_Pack(13, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_c, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word, __pyx_n_s_sentence_len); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_cbow, 772, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 772, __pyx_L1_error) /* "gensim/models/word2vec_inner.pyx":880 +======= + __pyx_tuple__21 = PyTuple_Pack(23, __pyx_n_s_model, __pyx_n_s_sentence, __pyx_n_s_work, __pyx_n_s_neu1, __pyx_n_s_cbow_mean, __pyx_n_s_syn0, __pyx_n_s_work_2, __pyx_n_s_neu1_2, __pyx_n_s_size, __pyx_n_s_codelens, __pyx_n_s_indexes, __pyx_n_s_sentence_len, __pyx_n_s_window, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_result, __pyx_n_s_syn1, __pyx_n_s_points, __pyx_n_s_codes, __pyx_n_s_vlookup, __pyx_n_s_token, __pyx_n_s_word); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_score_sentence_cbow, 589, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 589, __pyx_L1_error) + + /* "gensim/models/word2vec_inner.pyx":684 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def init(): # <<<<<<<<<<<<<< * """Precompute function `sigmoid(x) = 1 / (1 + exp(-x))`, for x values discretized into table EXP_TABLE. * Also calculate log(sigmoid(x)) into LOG_TABLE. */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_tuple__18 = PyTuple_Pack(7, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_expected, __pyx_n_s_size, __pyx_n_s_d_res, __pyx_n_s_p_res); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_gensim_models_word2vec_inner_pyx, __pyx_n_s_init, 880, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 880, __pyx_L1_error) +======= + __pyx_tuple__23 = PyTuple_Pack(7, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_expected, __pyx_n_s_size, __pyx_n_s_d_res, __pyx_n_s_p_res); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_models_word2vec_inner_pyx, __pyx_n_s_init, 684, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 684, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11313,6 +15018,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { return -1; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ @@ -11320,6 +15026,15 @@ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ +======= +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ +>>>>>>> Fixing the computation of the Word2Vec loss. static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations @@ -11359,11 +15074,14 @@ static int __Pyx_modinit_function_export_code(void) { if (__Pyx_ExportFunction("our_saxpy_noblas", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_our_saxpy_noblas, "void (int const *, float const *, float const *, int const *, float *, int const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("bisect_left", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_bisect_left, "unsigned PY_LONG_LONG (__pyx_t_5numpy_uint32_t *, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG, unsigned PY_LONG_LONG)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("random_int32", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_random_int32, "unsigned PY_LONG_LONG (unsigned PY_LONG_LONG *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__Pyx_ExportFunction("w2v_fast_sentence_sg_hs", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_sg_hs, "void (__pyx_t_5numpy_uint32_t const *, __pyx_t_5numpy_uint8_t const *, int const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_5numpy_uint32_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("w2v_fast_sentence_sg_neg", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_sg_neg, "unsigned PY_LONG_LONG (int const , __pyx_t_5numpy_uint32_t *, unsigned PY_LONG_LONG, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_5numpy_uint32_t const , __pyx_t_5numpy_uint32_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, unsigned PY_LONG_LONG, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("w2v_fast_sentence_cbow_hs", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_cbow_hs, "void (__pyx_t_5numpy_uint32_t const *, __pyx_t_5numpy_uint8_t const *, int *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_5numpy_uint32_t const *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int, int, int, int, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("w2v_fast_sentence_cbow_neg", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_w2v_fast_sentence_cbow_neg, "unsigned PY_LONG_LONG (int const , __pyx_t_5numpy_uint32_t *, unsigned PY_LONG_LONG, int *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_5numpy_uint32_t const *, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int, int, int, int, unsigned PY_LONG_LONG, __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *, int const , __pyx_t_6gensim_6models_14word2vec_inner_REAL_t *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("init_w2v_config", (void (*)(void))__pyx_f_6gensim_6models_14word2vec_inner_init_w2v_config, "PyObject *(struct __pyx_t_6gensim_6models_14word2vec_inner_Word2VecConfig *, PyObject *, PyObject *, PyObject *, PyObject *, struct __pyx_opt_args_6gensim_6models_14word2vec_inner_init_w2v_config *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) +======= +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11381,17 +15099,24 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", +======= + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", +>>>>>>> Fixing the computation of the Word2Vec loss. #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11412,6 +15137,17 @@ static int __Pyx_modinit_type_import_code(void) { return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); +======= + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; +>>>>>>> Fixing the computation of the Word2Vec loss. __Pyx_RefNannyFinishContext(); return -1; } @@ -11446,6 +15182,18 @@ static int __Pyx_modinit_function_import_code(void) { #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 +======= +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) + #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) +#else + #define CYTHON_SMALL_CODE +#endif +#endif +>>>>>>> Fixing the computation of the Word2Vec loss. #if PY_MAJOR_VERSION < 3 @@ -11535,11 +15283,15 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_word2vec_inner(PyObject *__pyx_pyi PyObject *__pyx_t_9 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'word2vec_inner' has already been imported. Re-initialisation is not supported."); return -1; } +======= + if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; +>>>>>>> Fixing the computation of the Word2Vec loss. #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif @@ -11603,6 +15355,7 @@ if (!__Pyx_RefNanny) { __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ @@ -11621,6 +15374,26 @@ if (!__Pyx_RefNanny) { } } #endif +======= + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_gensim__models__word2vec_inner) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "gensim.models.word2vec_inner")) { + if (unlikely(PyDict_SetItemString(modules, "gensim.models.word2vec_inner", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif +>>>>>>> Fixing the computation of the Word2Vec loss. /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ @@ -11916,13 +15689,18 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_sg, __pyx_t_1) < 0) __PYX_ERR(0, 500, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "gensim/models/word2vec_inner.pyx":591 +======= + /* "gensim/models/word2vec_inner.pyx":404 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): # <<<<<<<<<<<<<< * """Update CBOW model by training on a batch of sentences. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_3train_batch_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 591, __pyx_L1_error) @@ -11930,46 +15708,82 @@ if (!__Pyx_RefNanny) { /* "gensim/models/word2vec_inner.pyx":679 * +======= + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_3train_batch_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_train_batch_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":511 +>>>>>>> Fixing the computation of the Word2Vec loss. * * def score_sentence_sg(model, sentence, _work): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted skip-gram representation. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_5score_sentence_sg, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_sg, __pyx_t_1) < 0) __PYX_ERR(0, 679, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "gensim/models/word2vec_inner.pyx":772 +======= + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_5score_sentence_sg, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_sg, __pyx_t_1) < 0) __PYX_ERR(0, 511, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":589 +>>>>>>> Fixing the computation of the Word2Vec loss. * work[0] += f * * def score_sentence_cbow(model, sentence, _work, _neu1): # <<<<<<<<<<<<<< * """Obtain likelihood score for a single sentence in a fitted CBOW representation. * */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_7score_sentence_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "gensim/models/word2vec_inner.pyx":880 +======= + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_7score_sentence_cbow, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_score_sentence_cbow, __pyx_t_1) < 0) __PYX_ERR(0, 589, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":684 +>>>>>>> Fixing the computation of the Word2Vec loss. * * * def init(): # <<<<<<<<<<<<<< * """Precompute function `sigmoid(x) = 1 / (1 + exp(-x))`, for x values discretized into table EXP_TABLE. * Also calculate log(sigmoid(x)) into LOG_TABLE. */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_9init, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "gensim/models/word2vec_inner.pyx":927 +======= + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6gensim_6models_14word2vec_inner_9init, NULL, __pyx_n_s_gensim_models_word2vec_inner); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 684, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "gensim/models/word2vec_inner.pyx":725 +>>>>>>> Fixing the computation of the Word2Vec loss. * return 2 * * FAST_VERSION = init() # initialize the module # <<<<<<<<<<<<<< * MAX_WORDS_IN_BATCH = MAX_SENTENCE_LEN */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 927, __pyx_L1_error) @@ -11978,12 +15792,27 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_FAST_VERSION, __pyx_t_7) < 0) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "gensim/models/word2vec_inner.pyx":928 + /* "gensim/models/word2vec_inner.pyx":928 +======= + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FAST_VERSION, __pyx_t_7) < 0) __PYX_ERR(0, 725, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "gensim/models/word2vec_inner.pyx":726 +>>>>>>> Fixing the computation of the Word2Vec loss. * * FAST_VERSION = init() # initialize the module * MAX_WORDS_IN_BATCH = MAX_SENTENCE_LEN # <<<<<<<<<<<<<< */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WORDS_IN_BATCH, __pyx_int_10000) < 0) __PYX_ERR(0, 928, __pyx_L1_error) +======= + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WORDS_IN_BATCH, __pyx_int_10000) < 0) __PYX_ERR(0, 726, __pyx_L1_error) +>>>>>>> Fixing the computation of the Word2Vec loss. /* "gensim/models/word2vec_inner.pyx":1 * #!/usr/bin/env cython # <<<<<<<<<<<<<< @@ -11995,7 +15824,11 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* "../../.virtualenvs/release/local/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1046 +======= + /* "../../../anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1008 +>>>>>>> Fixing the computation of the Word2Vec loss. * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12435,6 +16268,122 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } #endif +/* GetItemInt */ +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; + } + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); +} +#endif + /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, @@ -12858,6 +16807,85 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { } #endif +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, @@ -12894,11 +16922,18 @@ __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; +======= + #if PY_VERSION_HEX >= 0x030700A3 + *type = tstate->exc_state.exc_type; + *value = tstate->exc_state.exc_value; + *tb = tstate->exc_state.exc_traceback; +>>>>>>> Fixing the computation of the Word2Vec loss. #else *type = tstate->exc_type; *value = tstate->exc_value; @@ -12910,6 +16945,7 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; @@ -12918,6 +16954,15 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; +======= + #if PY_VERSION_HEX >= 0x030700A3 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = type; + tstate->exc_state.exc_value = value; + tstate->exc_state.exc_traceback = tb; +>>>>>>> Fixing the computation of the Word2Vec loss. #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -12996,6 +17041,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; @@ -13006,6 +17052,15 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; } +======= + #if PY_VERSION_HEX >= 0x030700A3 + tmp_type = tstate->exc_state.exc_type; + tmp_value = tstate->exc_state.exc_value; + tmp_tb = tstate->exc_state.exc_traceback; + tstate->exc_state.exc_type = local_type; + tstate->exc_state.exc_value = local_value; + tstate->exc_state.exc_traceback = local_tb; +>>>>>>> Fixing the computation of the Word2Vec loss. #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -13182,6 +17237,7 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); @@ -13208,6 +17264,31 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON +======= + if (likely(result)) { + Py_INCREF(result); + } else if (unlikely(PyErr_Occurred())) { + result = NULL; + } else { +#else + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON +>>>>>>> Fixing the computation of the Word2Vec loss. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -13229,8 +17310,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* CLineInTraceback */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { +======= + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { +>>>>>>> Fixing the computation of the Word2Vec loss. PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -13243,9 +17329,13 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, *cython_runtime_dict, __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) +======= + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); +>>>>>>> Fixing the computation of the Word2Vec loss. } else #endif { @@ -13271,7 +17361,11 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { #endif /* CodeObjectCache */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +======= + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { +>>>>>>> Fixing the computation of the Word2Vec loss. int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -13351,7 +17445,11 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #include "compile.h" +======= + #include "compile.h" +>>>>>>> Fixing the computation of the Word2Vec loss. #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -13436,8 +17534,13 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +======= + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = (int) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { @@ -13467,7 +17570,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } /* CIntFromPyVerify */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +======= + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ +>>>>>>> Fixing the computation of the Word2Vec loss. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -13489,7 +17596,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } /* None */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { +======= + static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { +>>>>>>> Fixing the computation of the Word2Vec loss. long t = b; switch (e) { case 3: @@ -13516,8 +17627,13 @@ static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { } /* CIntToPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +======= + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = (long) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { @@ -13547,8 +17663,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { } /* CIntToPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0; +======= + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned PY_LONG_LONG value) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(unsigned PY_LONG_LONG) < sizeof(long)) { @@ -13578,7 +17699,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned P } /* Declarations */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_CCOMPLEX +======= + #if CYTHON_CCOMPLEX +>>>>>>> Fixing the computation of the Word2Vec loss. #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -13598,7 +17723,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned P #endif /* Arithmetic */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_CCOMPLEX +======= + #if CYTHON_CCOMPLEX +>>>>>>> Fixing the computation of the Word2Vec loss. #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -13733,7 +17862,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned P #endif /* Declarations */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_CCOMPLEX +======= + #if CYTHON_CCOMPLEX +>>>>>>> Fixing the computation of the Word2Vec loss. #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -13753,7 +17886,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned P #endif /* Arithmetic */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_CCOMPLEX +======= + #if CYTHON_CCOMPLEX +>>>>>>> Fixing the computation of the Word2Vec loss. #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -13888,8 +18025,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_PY_LONG_LONG(unsigned P #endif /* CIntToPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0; +======= + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum NPY_TYPES) < sizeof(long)) { @@ -13919,8 +18061,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES v } /* CIntFromPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG) ((PY_LONG_LONG) 0 - (PY_LONG_LONG) 1), const_zero = (PY_LONG_LONG) 0; +======= + static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG) -1, const_zero = (PY_LONG_LONG) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -14108,8 +18255,13 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_As_PY_LONG_LONG(PyObject *x) { } /* CIntFromPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +======= + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = (int) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -14297,8 +18449,13 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { } /* CIntFromPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) ((unsigned PY_LONG_LONG) 0 - (unsigned PY_LONG_LONG) 1), const_zero = (unsigned PY_LONG_LONG) 0; +======= + static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG(PyObject *x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG) -1, const_zero = (unsigned PY_LONG_LONG) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -14486,8 +18643,13 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_As_unsigned_PY_LONG_LONG( } /* CIntFromPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { const npy_uint32 neg_one = (npy_uint32) ((npy_uint32) 0 - (npy_uint32) 1), const_zero = (npy_uint32) 0; +======= + static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { + const npy_uint32 neg_one = (npy_uint32) -1, const_zero = (npy_uint32) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -14675,8 +18837,13 @@ static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { } /* CIntFromPy */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +======= + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; +>>>>>>> Fixing the computation of the Word2Vec loss. const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -14864,7 +19031,11 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { } /* FastTypeChecks */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 #if CYTHON_COMPILING_IN_CPYTHON +======= + #if CYTHON_COMPILING_IN_CPYTHON +>>>>>>> Fixing the computation of the Word2Vec loss. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -14964,7 +19135,11 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #endif /* CheckBinaryVersion */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static int __Pyx_check_binary_version(void) { +======= + static int __Pyx_check_binary_version(void) { +>>>>>>> Fixing the computation of the Word2Vec loss. char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -14980,7 +19155,11 @@ static int __Pyx_check_binary_version(void) { } /* VoidPtrExport */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { +======= + static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { +>>>>>>> Fixing the computation of the Word2Vec loss. PyObject *d; PyObject *cobj = 0; d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi); @@ -15011,7 +19190,11 @@ static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { } /* FunctionExport */ +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { +======= + static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { +>>>>>>> Fixing the computation of the Word2Vec loss. PyObject *d = 0; PyObject *cobj = 0; union { @@ -15047,8 +19230,96 @@ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *s return -1; } +<<<<<<< 074b9e83d58831437520045250c277a7e11b88d8 /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +======= +/* ModuleImport */ + #ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", + module_name, class_name, basicsize, size); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", + module_name, class_name, basicsize, size); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +/* InitStrings */ + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { +>>>>>>> Fixing the computation of the Word2Vec loss. while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { diff --git a/gensim/models/word2vec_inner.pyx b/gensim/models/word2vec_inner.pyx index 0576773bd5..81167b38d6 100755 --- a/gensim/models/word2vec_inner.pyx +++ b/gensim/models/word2vec_inner.pyx @@ -473,7 +473,7 @@ cdef init_w2v_config(Word2VecConfig *c, model, alpha, compute_loss, _work, _neu1 c[0].workers = model.workers c[0].compute_loss = (1 if compute_loss else 0) - c[0].running_training_loss = model.running_training_loss + c[0].running_training_loss = 0 c[0].syn0 = (np.PyArray_DATA(model.wv.vectors)) c[0].word_locks = (np.PyArray_DATA(model.trainables.vectors_lockf)) @@ -529,7 +529,6 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): init_w2v_config(&c, model, alpha, compute_loss, _work) - # prepare C structures so we can go "full C" and release the Python GIL vlookup = model.wv.vocab c.sentence_idx[0] = 0 # indices of the first sentence always start at 0 @@ -576,16 +575,18 @@ def train_batch_sg(model, sentences, alpha, _work, compute_loss): k = i + c.window + 1 - c.reduced_windows[i] if k > idx_end: k = idx_end + _running_training_loss_sample = 0 for j in range(j, k): if j == i: continue + effective_samples += 1 if c.hs: w2v_fast_sentence_sg_hs(c.points[i], c.codes[i], c.codelens[i], c.syn0, c.syn1, c.size, c.indexes[j], c.alpha, c.work, c.word_locks, c.compute_loss, &c.running_training_loss) if c.negative: c.next_random = w2v_fast_sentence_sg_neg(c.negative, c.cum_table, c.cum_table_len, c.syn0, c.syn1neg, c.size, c.indexes[i], c.indexes[j], c.alpha, c.work, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) - model.running_training_loss = c.running_training_loss - return effective_words + model.running_training_loss += _running_training_loss + return effective_words, effective_samples def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): @@ -672,8 +673,8 @@ def train_batch_cbow(model, sentences, alpha, _work, _neu1, compute_loss): if c.negative: c.next_random = w2v_fast_sentence_cbow_neg(c.negative, c.cum_table, c.cum_table_len, c.codelens, c.neu1, c.syn0, c.syn1neg, c.size, c.indexes, c.alpha, c.work, i, j, k, c.cbow_mean, c.next_random, c.word_locks, c.compute_loss, &c.running_training_loss) - model.running_training_loss = c.running_training_loss - return effective_words + model.running_training_loss += _running_training_loss + return effective_words, effective_words def score_sentence_sg(model, sentence, _work): diff --git a/gensim/scripts/word2vec_standalone.py b/gensim/scripts/word2vec_standalone.py index 57f4d907ba..2bd7e5297c 100644 --- a/gensim/scripts/word2vec_standalone.py +++ b/gensim/scripts/word2vec_standalone.py @@ -45,6 +45,8 @@ Compute accuracy of the resulting model analogical inference power on questions file See an example of questions file at https://code.google.com/p/word2vec/source/browse/trunk/questions-words.txt + -loss + If true, the loss will be computed and printed during training Example: python -m gensim.scripts.word2vec_standalone -train data.txt \ -output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 @@ -105,6 +107,8 @@ type=int, default=0, choices=[0, 1] ) parser.add_argument("-accuracy", help="Use questions from file ACCURACY to evaluate the model") + parser.add_argument("-loss", help="Should the loss will be computed and printed during training", + action="store_true") args = parser.parse_args() @@ -122,7 +126,8 @@ model = Word2Vec( corpus, size=args.size, min_count=args.min_count, workers=args.threads, window=args.window, sample=args.sample, alpha=args.alpha, sg=skipgram, - hs=args.hs, negative=args.negative, cbow_mean=1, iter=args.iter + hs=args.hs, negative=args.negative, cbow_mean=1, iter=args.iter, + compute_loss=args.loss ) if args.output: From 3a453a92a4f54a071be96d45bee61bc1eaf984d9 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 11:42:04 +0200 Subject: [PATCH 11/13] Fixing docstring --- gensim/scripts/word2vec_standalone.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gensim/scripts/word2vec_standalone.py b/gensim/scripts/word2vec_standalone.py index 2bd7e5297c..2c3e7e890b 100644 --- a/gensim/scripts/word2vec_standalone.py +++ b/gensim/scripts/word2vec_standalone.py @@ -7,7 +7,7 @@ """ USAGE: %(program)s -train CORPUS -output VECTORS -size SIZE -window WINDOW -cbow CBOW -sample SAMPLE -hs HS -negative NEGATIVE -threads THREADS -iter ITER --min_count MIN-COUNT -alpha ALPHA -binary BINARY -accuracy FILE +-min_count MIN-COUNT -alpha ALPHA -binary BINARY -accuracy FILE [-loss] Trains a neural embedding model on text file CORPUS. Parameters essentially reproduce those used by the original C tool @@ -45,11 +45,12 @@ Compute accuracy of the resulting model analogical inference power on questions file See an example of questions file at https://code.google.com/p/word2vec/source/browse/trunk/questions-words.txt - -loss - If true, the loss will be computed and printed during training + -loss <> + If present, the loss will be computed and printed during training Example: python -m gensim.scripts.word2vec_standalone -train data.txt \ -output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 + """ From a8e4a660a7315da87ca4902344dd694fcafff888 Mon Sep 17 00:00:00 2001 From: alreadytaikeune Date: Thu, 19 Jul 2018 12:25:38 +0200 Subject: [PATCH 12/13] Fixing flake8 error line too long --- gensim/models/base_any2vec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index cb3d34e3cd..8e4d012879 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -1343,7 +1343,8 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot # examples-based progress % if self.compute_loss: logger.info( - "EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + ("EPOCH %i - PROGRESS: at %.2f%% examples, %.0f words/s, " + "in_qsize %i, out_qsize %i, current_loss %.3f"), cur_epoch + 1, 100.0 * example_count / total_examples, trained_word_count / elapsed, utils.qsize(job_queue), utils.qsize(progress_queue), loss ) @@ -1363,7 +1364,8 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot ) else: logger.info( - "EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, in_qsize %i, out_qsize %i, current_loss %.3f", + ("EPOCH %i - PROGRESS: at %.2f%% words, %.0f words/s, " + "in_qsize %i, out_qsize %i, current_loss %.3f"), cur_epoch + 1, 100.0 * raw_word_count / total_words, trained_word_count / elapsed, utils.qsize(job_queue), utils.qsize(progress_queue), loss ) From 0f4d5725cd4835201e84dbbde85b45d1159a66a6 Mon Sep 17 00:00:00 2001 From: akhlif Date: Wed, 20 Feb 2019 10:35:14 +0100 Subject: [PATCH 13/13] Fixing docstrings and code redundancy --- gensim/models/base_any2vec.py | 25 ++++++++++++------------- gensim/models/word2vec.py | 5 +++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gensim/models/base_any2vec.py b/gensim/models/base_any2vec.py index 639fd8d473..afc18ca81a 100644 --- a/gensim/models/base_any2vec.py +++ b/gensim/models/base_any2vec.py @@ -131,7 +131,13 @@ def _do_train_epoch(self, corpus_file, thread_id, offset, cython_vocab, thread_p def _do_train_job(self, data_iterable, job_parameters, thread_private_mem): """Train a single batch. - ` + + Parameters + ---------- + data_iterable : an iterable chunk of data representing a batch + job_parameters : what is returned by `_get_job_params` + thread_private_mem : what is returned by `_get_thread_working_mem` + Returns ------- (int, int, int) @@ -231,8 +237,7 @@ def _worker_loop(self, job_queue, progress_queue): for callback in self.callbacks: callback.on_batch_begin(self) - stats_tuple = self._do_train_job( - data_iterable, job_parameters, thread_private_mem) + stats_tuple = self._do_train_job(data_iterable, job_parameters, thread_private_mem) if len(stats_tuple) == 3: tally, raw_tally, effective_samples = stats_tuple else: @@ -1109,11 +1114,10 @@ def train(self, sentences=None, corpus_file=None, total_examples=None, total_wor self.min_alpha = end_alpha or self.min_alpha self.compute_loss = compute_loss self.running_training_loss = 0.0 - return super(BaseWordEmbeddingsModel, self).train( - data_iterable=sentences, corpus_file=corpus_file, total_examples=total_examples, - total_words=total_words, epochs=epochs, start_alpha=start_alpha, end_alpha=end_alpha, word_count=word_count, - queue_factor=queue_factor, report_delay=report_delay, compute_loss=compute_loss, callbacks=callbacks, - **kwargs) + return super(BaseWordEmbeddingsModel, self).train(data_iterable=sentences, corpus_file=corpus_file, + total_examples=total_examples, total_words=total_words, epochs=epochs, start_alpha=start_alpha, + end_alpha=end_alpha, word_count=word_count, queue_factor=queue_factor, report_delay=report_delay, + compute_loss=compute_loss, callbacks=callbacks, **kwargs) def get_latest_training_loss(self): raise NotImplementedError( @@ -1338,11 +1342,6 @@ def _log_progress(self, job_queue, progress_queue, cur_epoch, example_count, tot always be equal to -1. """ - if self.compute_loss: - if total_samples == 0: - loss = -1 - else: - loss = self.get_latest_training_loss() / total_samples if total_examples: progress_unit = "examples" div = total_examples diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index eecdd7ddc9..37e0f374a7 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -816,8 +816,9 @@ def _do_train_job(self, sentences, alpha, inits): Returns ------- - (int, int) - 2-tuple (effective word count after ignoring unknown words and sentence length trimming, total word count). + (int, int, int) + 3-tuple (effective word count after ignoring unknown words and sentence length trimming, total word count, + total effective samples). """ work, neu1 = inits