AttributeError: 'Adam' object has no attribute 'get_weights'. Did you mean: 'set_weights'
时间: 2023-08-21 21:18:30 浏览: 265
引用\[1\]和\[2\]是关于一个错误的引用,它指出在Keras中的模块'keras.engine.topology'没有属性'load_weights_from_hdf5_group_by_name'。而引用\[3\]提供了一种解决方法,即修改代码,使用'saving'函数替换'topology'函数的功能。具体来说,可以将代码中的'topology.load_weights_from_hdf5_group_by_name'替换为'saving.load_weights_from_hdf5_group_by_name'。这样可以解决这个错误。
问题中提到的另一个错误是'AttributeError: 'Adam' object has no attribute 'get_weights'. Did you mean: 'set_weights''。这个错误表明在使用'Adam'优化器对象时,没有'get_weights'属性。可能是因为误用了'get_weights'方法,正确的方法应该是使用'set_weights'方法。所以建议将代码中的'get_weights'替换为'set_weights'来解决这个错误。
#### 引用[.reference_title]
- *1* *2* *3* [成功解决 AttributeError: module ‘keras.engine.topology‘ has no attribute ‘load_weights_from_hdf5_...](https://blog.csdn.net/qq_41185868/article/details/121665648)[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^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐


















