Tensorflow 2.1.0 错误,模块“tensorflow"没有属性“GraphKeys" [英] Tensorflow 2.1.0 Error, module 'tensorflow' has no attribute 'GraphKeys'

查看:66
本文介绍了Tensorflow 2.1.0 错误,模块“tensorflow"没有属性“GraphKeys"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天刚刚安装了新的 tf 和 cuda,但是当我运行以前与 tf-1.4 一起使用的代码时,在新的 tensorflow-2.1.0 和 cuda-10.1 下将无法运行

I just installed new tf and cuda today, but when I run the previous code that worked with tf-1.4 won't work under new tensorflow-2.1.0 and cuda-10.1

如何解决这个问题?

推荐答案

为了社区的利益,在答案部分提及解决方案(即使它出现在评论部分).

Mentioning the Solution in the Answer Section (even though it is present in Comments Section), for the benefit of the Community.

替换命令,

import tensorflow as tf

import tensorflow.compat.v1 as tf

已解决错误.

有关从 Tensorflow 1.x 迁移到 2.x 的更多信息,请参阅此Tensorflow 教程 和这个 升级脚本 也会有帮助.

For more information about Migrating from Tensorflow 1.x to 2.x, please refer this Tensorflow Tutorial and this Upgrade Script also will be helpful.

这篇关于Tensorflow 2.1.0 错误,模块“tensorflow"没有属性“GraphKeys"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆