More fixes for #3112

This commit is contained in:
Matthew Honnibal 2019-02-21 11:10:10 +01:00
parent e485241003
commit f31dbec528

View File

@ -268,7 +268,7 @@ class ParserStepModel(Model):
def backprop_parser_step(d_scores, sgd=None): def backprop_parser_step(d_scores, sgd=None):
# If we have a non-zero gradient for a previously unseen class, # If we have a non-zero gradient for a previously unseen class,
# replace the weight with 0. # replace the weight with 0.
new_classes = self.ops.xp.logical_and( new_classes = self.vec2scores.ops.xp.logical_and(
self.vec2scores.ops.xp.isnan(self.vec2scores.b), self.vec2scores.ops.xp.isnan(self.vec2scores.b),
d_scores.any(axis=0) d_scores.any(axis=0)
) )