而一臺(tái)機(jī)器上不同GPU的名稱是不同的,第n個(gè)GPU在TensorFlow中的名稱為/gpu:n召廷。比如第一個(gè)GPU的名稱為/gpu:0唁奢,第二個(gè)GPU名稱為/gpu:1否淤,以此類推。
這個(gè)還屬可以把運(yùn)算放在不同的設(shè)備上沃饶。
with tf.device('/cpu:0'):
?? a= tf.constant([1.0, 2.0, 3.0], shape=[3], name='a')
?? b= tf.constant([1.0, 2.0, 3.0], shape=[3], name='b')
with tf.device('/gpu:1'):
??? c= a + b