python - Tensorflow per_process_gpu_memory_fraction 不工作

标签 python python-3.x tensorflow keras

我使用的是 Tensorflow-gpu 1.10,因为我在使用 cuDNN 时遇到了问题。我想将它使用的 gpu 限制在 40%,所以我做到了

config.gpu_options.per_process_gpu_memory_fraction = 0.4
session = tf.Session(config=config)

我查看了 Omen Control Center 以查看我使用了多少 GPU,而它使用了大约 70% 的 GPU。我没有收到任何错误消息。我的 GPU 是 GTX 1080。我在网上找遍了其他人也有类似的问题,但没有一个解决方案有效。我也将 Keras 用于模型和图层。我也在 Jupyter Notebook 中这样做。

最佳答案

试试这个:

gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction = 0.4)
session = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)

关于python - Tensorflow per_process_gpu_memory_fraction 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54174740/

相关文章:

c# - 将基于 Python 的 TensorFlow 集成到 .NET 应用程序中

python - PyAutoGUIlocateOnScreen 方法中 minSearchTime 参数的目标是什么?

python - Pytest-html:根据标记自定义报告标题

python - 使用在 32x32 字母图像上训练的模型来预测整个文档 ocr 文本

tensorflow - 使用卷积网络运行时,tensorflow 会产生 nan 损失

Python 通过函数调用链传递参数

python - 使用 PIL/Pillow 在基本图像之上粘贴叠加层(带有文本)

python - Tkinter 跟踪和值错误 : invalid literal for int() with base 10: ''

python-3.x - 如何比较来自 PySpark 数据帧的记录

Python:点在最接近第三点的线上