More fixes for issue #3112

This commit is contained in:
Matthew Honnibal 2019-02-21 17:12:23 +01:00
parent 80bdcb99c5
commit d396a69c7b

View File

@ -204,7 +204,9 @@ class ParserModel(Model):
if new_output == self.upper.nO: if new_output == self.upper.nO:
return return
smaller = self.upper smaller = self.upper
larger = Affine(new_output, smaller.nI)
with Model.use_device('cpu'):
larger = Affine(new_output, smaller.nI)
# Set nan as value for unseen classes, to prevent prediction. # Set nan as value for unseen classes, to prevent prediction.
larger.W.fill(self.ops.xp.nan) larger.W.fill(self.ops.xp.nan)
larger.b.fill(self.ops.xp.nan) larger.b.fill(self.ops.xp.nan)