title: Tensorflow variable reuse
body: <p>I've built my LSTM model. Ideally I want to use reuse the variables to define a test LSTM model later.  </p>
  
  <pre><code>with tf.variable_scope('lstm_model') as scope:
      # Define LSTM Model
      lstm_model = LSTM_Model(rnn_size, batch_size, learning_rate,
                       training_seq_len, vocab_size)
      scope.reuse_variables()
      test_lstm_model = LSTM_Model(rnn_size, batch_size, learning_rate,
                       training_seq_len, vocab_size, infer=True)
  </code></pre>
  
  <p>The code above gives me an error</p>
  
  <pre><code>Variable lstm_model/lstm_vars/W already exists, disallowed. Did you mean to set reuse=True in VarScope? 
  </code></pre>
  
  <p>If I set the reuse=True as shown in the below code block</p>
  
  <pre><code>with tf.variable_scope('lstm_model', reuse=True) as scope:
  </code></pre>
  
  <p>I get a different error</p>
  
  <pre><code>Variable lstm_model/lstm_model/lstm_vars/W/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?
  </code></pre>
  
  <p>As a reference I've appended the relevant model code below. The corresponding section in the LSTM model where I have the weights</p>
  
  <pre><code>with tf.variable_scope('lstm_vars'):
      # Softmax Output Weights
      W = tf.get_variable('W', [self.rnn_size, self.vocab_size], tf.float32, tf.random_normal_initializer())
  </code></pre>
  
  <p>The corresponding section where I have my Adam optimizer: </p>
  
  <pre><code>optimizer = tf.train.AdamOptimizer(self.learning_rate)
  </code></pre>