当我在tensorflow中调用cosine_decay函数时,它显示以下错误:
'<' not supported between instances of 'CosineDecay' and 'int'
下面是我的代码:
decay_steps = 1000
lr_decayed_fn = tf.keras.experimental.CosineDecay(initial_learning_rate=0.01, decay_steps=1000)
model.compile(optimizer=Adam(lr=lr_decayed_fn), loss=dice_coef_loss, metrics=[dice_coef])我只是遵循了tensorflow上的教程,我不知道为什么会出现这个错误
发布于 2021-01-16 04:07:26
将Adam(lr=lr_decayed_fn)更改为Adam(learning_rate=lr_decayed_fn)
tensorflow v2中的Adam优化器调用需要拼写出learning_rate,它没有将参数作为“lr”。请参阅此问题:https://github.com/tensorflow/tensorflow/issues/44172
https://stackoverflow.com/questions/64791367
复制相似问题