From fc06b0a33357352c99c5b1e41789c15920daac73 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 5 Oct 2017 21:52:28 -0500 Subject: [PATCH] Fix training when hist_size==0 --- spacy/_ml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/_ml.py b/spacy/_ml.py index 6223715b5..d6e745f22 100644 --- a/spacy/_ml.py +++ b/spacy/_ml.py @@ -257,6 +257,8 @@ class Embed(Model): def HistoryFeatures(nr_class, hist_size=8, nr_dim=8): '''Wrap a model, adding features representing action history.''' + if hist_size == 0: + return layerize(noop()) embed_tables = [Embed(nr_dim, nr_class, column=i, name='embed%d') for i in range(hist_size)] embed = concatenate(*embed_tables)