'Adam' object has no attribute 'lr'
时间: 2023-08-27 18:04:43 浏览: 399
这个错误是因为在使用Adam优化器时,尝试访问了'Adam'对象的"lr"属性,但该属性不存在。通常,Adam优化器的学习率参数是通过"learning_rate"来指定的。因此,为了解决这个问题,你需要将"lr"改为"learning_rate"。例如,你可以将代码修改为:model.compile(loss=['binary_crossentropy'], optimizer=optimizers.Adam(learning_rate=0.0001, beta_1=0.9, beta_2=0.999, epsilon=1e-08), metrics=['accuracy'])。这样就能正确地使用Adam优化器的学习率参数了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [报错‘Adam‘ object has no attribute ‘lr‘或python报错‘Adam‘ object has no attribute ‘learning_...](https://blog.csdn.net/weixin_45647721/article/details/123337423)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [AttributeError: ‘tuple‘ object has no attribute ‘shape](https://blog.csdn.net/hu3753/article/details/122379899)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文