注:安装好Tensorflow2.0后,当使用Session时,报错AtributeError: module ‘tensorflow’ has no attribute ‘Session’:

错误的意思是tensorflow模块没有Session属性,后来查阅资料发现,tensorflow2.0版本中的确没有Session这个属性

解决问题如下:`
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
sess = tf.compat.v1.Session()

在这里插入图片描述

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐