AttributeError: module ‘tensorflow’ has no attribute ‘Session’ AttributeError: module ‘tensorflow’ has no attribute ‘InteractiveSession’
AttributeError: module ‘tensorflow’ has no attribute 'assign’
我下载的是tensorflow2.0,但在网上找到的学习资源都是2.0以下的
所以总会碰见tensorflow里没有对应的模块等错误
领悟到一点就是去兼容低版本的
解决办法如下:
sess = tf.compat.v1.Session()
update = tf.compat.v1.assign(state, new_value)
init_op = tf.compat.v1.initialize_all_variables()
就相应地加上**.compat.v1.**
如果有其他的解决办法,也请大家告知。
或者有其他学习资源的也请告知。