From fbba7c517ece539f9b1c24df4f545b56189def72 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 6 Oct 2017 06:09:18 -0500 Subject: [PATCH] Pass dropout through to embed tables --- spacy/_ml.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spacy/_ml.py b/spacy/_ml.py index 7761e6d11..f79c5668a 100644 --- a/spacy/_ml.py +++ b/spacy/_ml.py @@ -266,15 +266,10 @@ def HistoryFeatures(nr_class, hist_size=8, nr_dim=8): ops = embed.ops def add_history_fwd(vectors_hists, drop=0.): vectors, hist_ids = vectors_hists - hist_feats, bp_hists = embed.begin_update(hist_ids) + hist_feats, bp_hists = embed.begin_update(hist_ids, drop=drop) outputs = ops.xp.hstack((vectors, hist_feats)) - mask = ops.get_dropout_mask(outputs.shape, drop) - if mask is not None: - outputs *= mask def add_history_bwd(d_outputs, sgd=None): - if mask is not None: - d_outputs *= mask d_vectors = d_outputs[:, :vectors.shape[1]] d_hists = d_outputs[:, vectors.shape[1]:] bp_hists(d_hists, sgd=sgd)