import tensorflow as tf
with tf.device('/gpu:0'):
foo = tf.Variable(1, name='foo')
assert foo.name == "foo:0"
with tf.device('/gpu:1'):
bar = tf.Variable(1, name='bar')
assert bar.name == "bar:0"
The above code returns true.I use with tf.device
here to illustrate that the ":0" doesn't mean the variable lie on the specific device.So what's the meaning of the ":0" in the variable's name(foo and bar in this example)?