Why the tf.name_scope with same name is different?

Viewed 2690

Look at the code snippet:

import tensorflow as tf

with tf.name_scope('y'):
    a1 = tf.Variable(1,name='a')

with tf.name_scope('y'):
    a2 = tf.Variable(1,name='b')

print(a1.name)
print(a2.name)

The output is

y/a:0
y_1/b:0

Why the the name_scope of variable a2 is y_1?

2 Answers
Related