我已经在 Ubuntu 14.04 上安装了 GPU 版本的 tensorflow。
我在 GPU 服务器上,tensorflow 可以访问可用的 GPU。
我想在 CPU 上运行 tensorflow。
通常我可以使用 env CUDA_VISIBLE_DEVICES=0
在 GPU 上运行。 0。
我该如何在 CPU 之间进行选择?
我对用 with tf.device("/cpu:0"):
重写我的代码不感兴趣
原文由 Alexander R Johansen 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以应用
device_count
参数tf.Session
:另见 protobuf 配置文件:
tensorflow/core/framework/config.proto