Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's difference between `variable.name` and `variable.op.name`?

Tags:

tensorflow

Suppose x is a Variable, I saw use of op.name like tf.scalar_summary(x.op.name, x) in the tutorial. I am wondering if I can replace x.op.name with x.name in general.

What's the difference between the two? Are they interchangeable?

with tf.name_scope('ab'):
    a = tf.Variable(tf.constant(1), name="v1")

a.name
u'ab_1/v1:0'

a.op.name
u'ab_1/v1'
like image 456
colinfang Avatar asked Jan 11 '16 17:01

colinfang


1 Answers

Right now the Variable.name property maps to the name of the mutable Tensor in which that variable is stored (principally because a Variable can be used wherever a Tensor is expected). Tensor names are generated from the name of the operation that produces them (a Variable op in this case) and the index of the output to which that tensor corresponds.

You can feel free to use tf.scalar_summary(x.name, x) in place of tf.scalar_summary(x.op.name, x), but the resulting visualizations will contain a redundant ":<N>" in the tags.

like image 78
mrry Avatar answered Oct 20 '22 22:10

mrry