AttributeError: module ‘tensorflow.compat.v2.__internal__‘ has no attribute ‘register_clear_session_

报错提示:
AttributeError: module ‘tensorflow.compat.v2.internal’ has no attribute ‘register_clear_session_function’

报错原因总结:
这是个版本兼容问题,即keras与tensorflow版本不兼容,相信出现这个问题的朋友在导入包的时候以形如:keras.XX import XX等格式出现,然后tensorflow版本又是2.0以上。

解决方式:
解决方式很简单,在keras前面加个tensorflow,即tensorflow.keras.XX
毕竟,tensorflow2.0以上的版本,兼容了keras。

你可能感兴趣的:(tensorflow,keras,深度学习)