Fix update when update_shared=False

This commit is contained in:
Matthew Honnibal 2017-08-20 15:58:34 -05:00
parent 7a6edeea68
commit 78a5f842e9

View File

@ -322,8 +322,8 @@ class Language(object):
all_d_tokvecses[i] += d_tv
if update_shared and bp_tokvecses is not None:
bp_tokvecses(all_d_tokvecses, sgd=sgd)
for key, (W, dW) in grads.items():
sgd(W, dW, key=key)
for key, (W, dW) in grads.items():
sgd(W, dW, key=key)
# Clear the tensor variable, to free GPU memory.
# If we don't do this, the memory leak gets pretty
# bad, because we may be holding part of a batch.