keras Variable set_value错误解决

问题:

如:

from keras import backend as K
varib = K.variable(0.)
new_value = np.min([0.1, 1.0])
varib.set_value(new_value)

报错:

AttributeError: 'Variable' object has no attribute 'set_value'

 

解决办法:

from keras import backend as K
K.set_value(self.kl_weight, new_value)
posted @ 2018-07-18 10:44  胡立峰  阅读(1335)  评论(0编辑  收藏  举报