title: About names of variable scope in tensorflow
body: <p>Recently I have been trying to learn to use TensorFlow, and I do not understand how variable scopes work exactly. In particular, I have the following problem:</p>
  
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  from tensorflow.models.rnn import rnn_cell
  from tensorflow.models.rnn import rnn
  
  inputs = [tf.placeholder(tf.float32,shape=[10,10]) for _ in range(5)]
  cell = rnn_cell.BasicLSTMCell(10)
  outpts, states = rnn.rnn(cell, inputs, dtype=tf.float32)
  
  print outpts[2].name
  # ==&gt; u'RNN/BasicLSTMCell_2/mul_2:0'
  </code></pre>
  
  <p>Where does the  <code>'_2'</code> in <code>'BasicLSTMCell_2'</code> come from? How does it work when later using <code>tf.get_variable(reuse=True)</code> to get the same variable again?</p>
  
  <p>edit: I think I find a related problem:</p>
  
  <pre class="lang-py prettyprint-override"><code>def creating(s):
      with tf.variable_scope('test'):
          with tf.variable_scope('inner'):
              a=tf.get_variable(s,[1])
      return a
  
  def creating_mod(s):
      with tf.variable_scope('test'):
          with tf.variable_scope('inner'):
              a=tf.Variable(0.0, name=s)
      return a
  
  tf.ops.reset_default_graph()
  a=creating('a')
  b=creating_mod('b')
  c=creating('c')
  d=creating_mod('d')
  
  print a.name, '\n', b.name,'\n', c.name,'\n', d.name
  </code></pre>
  
  <p>The output is</p>
  
  <pre class="lang-py prettyprint-override"><code>test/inner/a:0 
  test_1/inner/b:0 
  test/inner/c:0 
  test_3/inner/d:0
  </code></pre>
  
  <p>I'm confused...</p>