Fix tagger training on GPU

This commit is contained in:
Matthew Honnibal 2018-09-13 14:05:37 +02:00
parent b2cb1fc67d
commit d6aa60139d
1 changed files with 1 additions and 1 deletions

View File

@ -681,7 +681,7 @@ class Tagger(Pipe):
idx += 1
correct = self.model.ops.xp.array(correct, dtype='i')
d_scores = scores - to_categorical(correct, nb_classes=scores.shape[1])
d_scores *= known_labels
d_scores *= self.ops.asarray(known_labels)
loss = (d_scores**2).sum()
d_scores = self.model.ops.unflatten(d_scores, [len(d) for d in docs])
return float(loss), d_scores