美文网首页
tensorflow tf.device

tensorflow tf.device

作者: 猴子喜 | 来源:发表于2018-10-01 10:06 被阅读0次

而一台机器上不同GPU的名称是不同的,第n个GPU在TensorFlow中的名称为/gpu:n。比如第一个GPU的名称为/gpu:0,第二个GPU名称为/gpu:1,以此类推。

这个还属可以把运算放在不同的设备上。

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

相关文章

网友评论

      本文标题:tensorflow tf.device

      本文链接:https://www.haomeiwen.com/subject/pntnoftx.html