keras Variable set_value錯誤解決

問題:spa

如:import

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

報錯:object

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

 

解決辦法:co

from keras import backend as K
K.set_value(self.kl_weight, new_value)
相關文章
相關標籤/搜索