我想指定运行我的进程的gpu.我将其设置如下:
import tensorflow as tf
with tf.device('/gpu:0'):
a = tf.constant(3.0)
with tf.Session() as sess:
while True:
print sess.run(a)
Run Code Online (Sandbox Code Playgroud)
但是它仍然在我的两个gpus中分配内存.
| 0 7479 C python 5437MiB
| 1 7479 C python 5437MiB
Run Code Online (Sandbox Code Playgroud)