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'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With