bojone / keras_lookahead

lookahead optimizer for keras
170 stars 31 forks source link

meet this error! #1

Closed FakerYFX closed 5 years ago

FakerYFX commented 5 years ago

lookahead.inject(model) File "bilstm_crf_model.py", line 44, in inject slow_updates.append(K.update(q, q + self.alpha * (p - q))) File "/home/work/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 971, in update return tf.assign(x, new_x) File "/home/work/.local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 222, in assign return ref.assign(value, name=name) AttributeError: 'Tensor' object has no attribute 'assign'

newhotter commented 5 years ago

同样的错误

newhotter commented 5 years ago

slow_params = [K.variable(K.zeros_like(p)) for p in fast_params] 问题就解决了

bojone commented 5 years ago

不好意思,之前弄错了,旧代码会有bug,请务必同步新代码。

FakerYFX commented 5 years ago

多谢苏神