![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
feijianxiaolin
这个作者很懒,什么都没留下…
展开
-
tensorflow2 AttributeError: module ‘tensorflow‘ has no attribute ‘Session‘
转载链接:https://blog.csdn.net/qq_40575024/article/details/105862550收起出现问题:AttributeError: module ‘tensorflow’ has no attribute ‘Session’原因:tensorflow2删除了 tf.Session()解决方法:tf.Session() 将改为tf.compat.v1.Session()或者版本降级:pip install tensorflow==1.4转载 2020-12-14 16:58:59 · 184 阅读 · 0 评论 -
RuntimeError: The Session graph is empty. Add operations to the graph before calling run().解决方法
问题产生的原因:无法执行sess.run()的原因是tensorflow版本不同导致的,tensorflow版本2.0无法兼容版本1.0.解决办法:tf.compat.v1.disable_eager_execution()import tensorflow as tftf.compat.v1.disable_eager_execution() #保证sess.run()能够正常运行hello = tf.constant('hello,tensorflow')sess= tf.compat.转载 2020-12-14 16:57:17 · 1683 阅读 · 0 评论