From 99a84e4d0e33f96aef304ab58c8d4fc6e9455179 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 19 Dec 2018 02:10:36 +0100 Subject: [PATCH] Make ParserModel.resize_output idempotent --- spacy/syntax/_parser_model.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/syntax/_parser_model.pyx b/spacy/syntax/_parser_model.pyx index 5615fcea1..fd87aab2b 100644 --- a/spacy/syntax/_parser_model.pyx +++ b/spacy/syntax/_parser_model.pyx @@ -201,6 +201,8 @@ class ParserModel(Model): return step_model, finish_parser_update def resize_output(self, new_output): + if new_output == self.upper.nO: + return smaller = self.upper larger = Affine(new_output, smaller.nI) larger.W *= 0