title: Can't access TensorFlow Adam optimizer namespace
body: <p>I'm trying to learn about GANs and I'm working through <a href="https://github.com/llSourcell/Generative_Adversarial_networks_LIVE/blob/master/EZGAN.ipynb" rel="nofollow noreferrer">the example here</a>.</p>
  
  <p>The code below using the Adam optimizer gives me the error</p>
  
  <blockquote>
    <p>"ValueError: Variable d_w1/Adam/ does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?"</p>
  </blockquote>
  
  <p>I'm using TF 1.1.0</p>
  
  <pre class="lang-py prettyprint-override"><code>d_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dx, labels=tf.fill([batch_size, 1], 0.9)))
  d_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dg, labels=tf.zeros_like(Dg)))
  d_loss = d_loss_real + d_loss_fake
  
  tvars = tf.trainable_variables()
  
  d_vars = [var for var in tvars if 'd_' in var.name]
  g_vars = [var for var in tvars if 'g_' in var.name]
  
  
  
  # Train the discriminator
  # Increasing from 0.001 in GitHub version
  with tf.variable_scope(tf.get_variable_scope(), reuse=False) as scope:
  
      # Next, we specify our two optimizers. In today’s era of deep learning, Adam seems to be the
      # best SGD optimizer as it utilizes adaptive learning rates and momentum. 
      # We call Adam's minimize function and also specify the variables that we want it to update.
      d_trainer_real = tf.train.AdamOptimizer(0.0001).minimize(d_loss_real, var_list=d_vars)
      d_trainer_fake = tf.train.AdamOptimizer(0.0001).minimize(d_loss_fake, var_list=d_vars)
  </code></pre>
  
  <p>I think the Adam optimizer is taking the variables into its own namespace but for some reason they aren't initialized. I do call <code>global_variables_initializer</code> later in the code, as can be seen on the github page. I'm checking through the documentation, I think it may be related to me having to put some kind of <code>reuse_variables()</code> call in there, but I'm not sure.</p>
  
  <p>Any help much appreciated.</p>