报错AttributeError: module 'tensorflow' has no attribute 'Session'

2022/6/17 23:28:16

本文主要是介绍报错AttributeError: module 'tensorflow' has no attribute 'Session',对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

在新的Tensorflow 2.0版本中已经移除了Session这一模块。

tf.compat.v1.Session() 就可以获得与原先相同的输出信息。

其他类似的报错也可使用这种方法:'placeholder',tf.compat.v1.placeholder() 。

 

也可以将Tensorflow的版本降低,用pip安装 pip install tensorflow==1.14。



这篇关于报错AttributeError: module 'tensorflow' has no attribute 'Session'的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程