From fa6d4733904e29d304db92c455e6d8358ada8259 Mon Sep 17 00:00:00 2001 From: Matthw Honnibal Date: Wed, 1 Jul 2020 02:48:58 +0200 Subject: [PATCH] Fix parser maxout_pieces=1 --- spacy/syntax/_parser_model.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/syntax/_parser_model.pyx b/spacy/syntax/_parser_model.pyx index 93ec68c95..853facdc6 100644 --- a/spacy/syntax/_parser_model.pyx +++ b/spacy/syntax/_parser_model.pyx @@ -465,6 +465,7 @@ cdef class precompute_hiddens: return state_vector, backprop_maxout def _relu_nonlinearity(self, state_vector): + state_vector = state_vector.reshape((state_vector.shape[0], -1)) mask = state_vector >= 0. state_vector *= mask # We're outputting to CPU, but we need this variable on GPU for the @@ -473,7 +474,6 @@ cdef class precompute_hiddens: def backprop_relu(d_best): d_best *= mask - d_best = d_best.reshape((d_best.shape + (1,))) - return d_best + return d_best.reshape((d_best.shape + (1,))) return state_vector, backprop_relu