From a2162b89086aeecf8b92891ca516f40fc666efb1 Mon Sep 17 00:00:00 2001 From: uwol Date: Sun, 5 Nov 2017 12:25:10 +0100 Subject: [PATCH] tensorizer return parameter fix --- spacy/pipeline.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spacy/pipeline.pyx b/spacy/pipeline.pyx index a159fad50..5a72dc946 100644 --- a/spacy/pipeline.pyx +++ b/spacy/pipeline.pyx @@ -318,7 +318,7 @@ class Tensorizer(Pipe): loss, d_scores = self.get_loss(docs, golds, scores) d_inputs = bp_scores(d_scores, sgd=sgd) d_inputs = self.model.ops.xp.split(d_inputs, len(self.input_models), axis=1) - for d_input, bp_input in zip(d_inputs, bp_inputs): + for d_input, bp_input in zip(d_inputs, bp_inputs): bp_input(d_input, sgd=sgd) if losses is not None: losses.setdefault(self.name, 0.) @@ -777,7 +777,8 @@ class TextCategorizer(Pipe): def predict(self, docs): scores = self.model(docs) scores = self.model.ops.asarray(scores) - return scores + tensors = [doc.tensor for doc in docs] + return scores, tensors def set_annotations(self, docs, scores, tensors=None): for i, doc in enumerate(docs):