title: tensorflow Adamoptimizer beta1_power not initialized
body: <p>I'm doing transfer learning, thus I pre-trained a network, saved the variables (w, b) in a file; closed the program; re-opened another program; restored all old variables; defined some new layers of variables, initialized them; then started re-training. SGD optimizer works in my code, but if I change the optimizer to Adam, it gives me the following error:</p>
  
  <p><code>2017-08-03 21:28:08.785092: W tensorflow/core/framework/op_kernel.cc:1152] Failed precondition: Attempting to use uninitialized value beta1_power
  </code></p>
  
  <p>My code: </p>
  
  <pre><code># Session Start
  sess = tf.Session()
  # restore pre-trained parameters
  saver = tf.train.Saver()
  saver.restore(sess, "./pre_train/step1.ckpt")
  # init new parameters
  weights2 = {
      'fnn_w1': tf.Variable(tf.random_normal([n_hidden_2, n_hidden_1], stddev= sd), name='fnn_w1'),
      'fnn_w2': tf.Variable(tf.random_normal([n_hidden_1, 1], stddev= sd), name='fnn_w2')
  }
  biases2 = {
      'fnn_b1': tf.Variable(tf.ones([n_hidden_1]), name='fnn_b1'),
      'fnn_b2': tf.Variable(tf.ones([1]), name='fnn_b2')
  }
  parameters2 = {**weights2, **biases2}
  init_params2 = tf.variables_initializer(parameters2.values())
  sess.run(init_params2)
  
  # Construct model
  encoder_op = encoder(X)
  focusFnn_op = focusFnn(encoder_op)  # for one gene a time prediction
  decoder_op = decoder(encoder_op)  # for pearson correlation of the whole matrix #bug (8092, 0)
  
  # Prediction and truth
  y_pred = focusFnn_op  # [m, 1]
  y_true = X[:, j]
  y_benchmark = M[:, j]  # benchmark for cost_fnn
  M_train = df2_train.values[:, j:j+1]  # benchmark for corr
  M_valid = df2_valid.values[:, j:j+1]
  
  # Define loss and optimizer, minimize the squared error
  with tf.name_scope("Metrics"):
      cost_fnn = tf.reduce_mean(tf.pow(y_true - y_pred, 2))
      cost_fnn_benchmark = tf.reduce_mean(tf.pow(y_pred- y_benchmark, 2))
      cost_decoder = tf.reduce_mean(tf.pow(X - decoder_op, 2))
      cost_decoder_benchmark = tf.reduce_mean(tf.pow(decoder_op - M, 2))
      tf.summary.scalar('cost_fnn', cost_fnn)
      tf.summary.scalar('cost_fnn_benchmark', cost_fnn_benchmark)
      tf.summary.scalar('cost_decoder', cost_decoder)
      tf.summary.scalar('cost_decoder_benchmark', cost_decoder_benchmark)
  
  # optimizer = (
  #     tf.train.GradientDescentOptimizer(learning_rate).
  #     minimize(cost_fnn, var_list=[list(weights2.values()), list(biases2.values())])
  # )# frozen other variables
  
  optimizer = (
      tf.train.GradientDescentOptimizer(learning_rate).
      minimize(cost_fnn)
  )# frozen other variables
  print("# Updated layers: ", "fnn layers\n")
  
  train_writer = tf.summary.FileWriter(log_dir+'/train', sess.graph)
  valid_writer = tf.summary.FileWriter(log_dir+'/valid', sess.graph)
  # benchmark_writer = tf.summary.FileWriter(log_dir+'/benchmark', sess.graph)
  
  # Evaluate the init network
  [cost_train, h_train] = sess.run([cost_fnn, y_pred], feed_dict={X: df_train.values})
  [cost_valid, h_valid] = sess.run([cost_fnn, y_pred], feed_dict={X: df_valid.values})
  </code></pre>