From 3274b46a0d3255975178f669c7b5c83f57be48fb Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 26 Sep 2017 09:05:53 -0500 Subject: [PATCH] Try to fix compile error on Windows --- spacy/syntax/nn_parser.pyx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index a77352212..99099cad8 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -419,21 +419,23 @@ cdef class Parser: c_token_ids = token_ids.data c_is_valid = is_valid.data cdef int has_hidden = not getattr(vec2scores, 'is_noop', False) + cdef int nr_step while not next_step.empty(): + nr_step = next_step.size() if not has_hidden: - for i in cython.parallel.prange( - next_step.size(), num_threads=6, nogil=True): + for i in cython.parallel.prange(nr_step, num_threads=6, + nogil=True): self._parse_step(next_step[i], feat_weights, nr_class, nr_feat, nr_piece) else: - for i in range(next_step.size()): + for i in range(nr_step): st = next_step[i] st.set_context_tokens(&c_token_ids[i*nr_feat], nr_feat) self.moves.set_valid(&c_is_valid[i*nr_class], st) vectors = state2vec(token_ids[:next_step.size()]) scores = vec2scores(vectors) c_scores = scores.data - for i in range(next_step.size()): + for i in range(nr_step): st = next_step[i] guess = arg_max_if_valid( &c_scores[i*nr_class], &c_is_valid[i*nr_class], nr_class)