From faa86565820b8087f3eb78fe4a2bb55be88d4dc3 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 19 Dec 2018 02:11:26 +0100 Subject: [PATCH] Port parser fix for large label sets from master --- spacy/syntax/nn_parser.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index d467309f2..2a2e05386 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -341,7 +341,7 @@ cdef class Parser: cdef void c_transition_batch(self, StateC** states, const float* scores, int nr_class, int batch_size) nogil: - cdef int[500] is_valid # TODO: Unhack + is_valid = calloc(self.moves.n_moves, sizeof(int)) cdef int i, guess cdef Transition action for i in range(batch_size): @@ -350,6 +350,7 @@ cdef class Parser: action = self.moves.c[guess] action.do(states[i], action.label) states[i].push_hist(guess) + free(is_valid) def transition_beams(self, beams, float[:, ::1] scores): cdef Beam beam