报错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。

相关文章

MNIST数据集可以说是深度学习的入门,但是使用模型预测单张M...
1、新建tensorflow环境(1)打开anacondaprompt,输入命令行...
这篇文章主要介绍“张量tensor是什么”,在日常操作中,相信...
tensorflow中model.fit()用法model.fit()方法用于执行训练过...
https://blog.csdn.net/To_be_little/article/details/12443...
根据身高推测体重const$=require('jquery');const...