其他分享
首页 > 其他分享> > module 'tensorflow' has no attribute 'ConfigProto'/'Session'解决方法

module 'tensorflow' has no attribute 'ConfigProto'/'Session'解决方法

作者:互联网

因为tensorflow2.0版本与之前版本有所更新,故将代码修改即可:

#原 config = tf.ConfigProto(allow_soft_placement=True)
config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
#原 sess = tf.Session(config=config)
sess =tf.compat.v1.Session(config=config)

标签:compat,sess,no,attribute,module,Session,ConfigProto,tf,config
来源: https://www.cnblogs.com/yuanxiaochou/p/12572761.html