gpt4 book ai didi

python - Tensorflow 2.1.0错误,模块 'tensorflow'没有属性 'GraphKeys'

转载 作者:行者123 更新时间:2023-12-02 06:00:03 24 4
gpt4 key购买 nike

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

如何解决这个问题?

最佳答案

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

替换命令,

import tensorflow as tf

import tensorflow.compat.v1 as tf

已解决该错误。

有关从 Tensorflow 1.x 迁移到 2.x 的更多信息,请参阅此 Tensorflow Tutorial还有这个Upgrade Script也会有帮助。

关于python - Tensorflow 2.1.0错误,模块 'tensorflow'没有属性 'GraphKeys',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59890090/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com