模块“tensorflow”没有属性“GPUOptions”

An *_*ông 14 gpu tensorflow

我正在使用带有 GTX 960M 的戴尔笔记本电脑,并且我安装了 tensorflow 2.0 alpha。我曾经使用 1.5 版本并且它与 tf.GPUOptions 一起使用,但是在这个版本中,error: AttributeError: module 'tensorflow' has no attribute 'GPUOptions' 如果我在这个版本上做错了,这会导致有人帮助我

回溯(最近一次调用):文件“prepare_training.py”,第 20 行,在 gpu_option = tf.GPUOptions(per_process_gpu_memory_fraction=0.333) AttributeError: module 'tensorflow' has no attribute 'GPUOptions'

Roh*_*hit 14

Tensorflow 2.x 与 1.x 相比发生了重大变化。

根据官方消息,

tf.contrib 将从核心 TensorFlow 存储库和构建过程中删除。TensorFlow 的 contrib 模块已经超出了单个存储库中可以维护和支持的范围。较大的项目最好单独维护,而较小的扩展将升级为核心 TensorFlow 代码。已经成立了一个特殊兴趣小组 (SIG) 来维护和进一步发展一些更重要的贡献项目。如果您有兴趣做出贡献,请参与RFC。

如果你想使用tensorflow 1.x函数/方法,有一个兼容模块保存在tensorflow 2.x.

tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.333)
Run Code Online (Sandbox Code Playgroud)