title: why use placeholder when we already know it's value?
body: <p>I am reading "Hands on Machine Learning and with Scikit-Learn and TensorFlow". Here is it's code for reusing models from other frameworks. We already know original_w and original_b, we want to assign them to hidden1/weights and hidden1/biases respectively. My question is "why use original_weights placeholder? can we use tf.assign(hidden1_weights, original_w) directly?"</p>
  
  <pre><code>original_w = [...] # Load the weights from the other framework
  original_b = [...] # Load the biases from the other framework
  X = tf.placeholder(tf.float32, shape=(None, n_inputs), name="X")
  hidden1 = fully_connected(X, n_hidden1, scope="hidden1"
  [...] # Build the rest of the model
  # Get a handle on the variables created by fully_connected() 
  with tf.variable_scope("", default_name="", reuse=True): # root scope
  hidden1_weights = tf.get_variable("hidden1/weights") 
  hidden1_biases = tf.get_variable("hidden1/biases")
  
  # Create nodes to assign arbitrary values to the weights and biases 
  original_weights = tf.placeholder(tf.float32, shape=(n_inputs, n_hidden1)) 
  original_biases = tf.placeholder(tf.float32, shape=(n_hidden1)) 
  
  assign_hidden1_weights = tf.assign(hidden1_weights,original_weights) 
  assign_hidden1_biases = tf.assign(hidden1_biases, original_biases)
  
  
  init = tf.global_variables_initializer()
  with tf.Session() as sess: sess.run(init) 
      sess.run(assign_hidden1_weights, feed_dict={original_weights: original_w}) 
      sess.run(assign_hidden1_biases, feed_dict={original_biases: original_b}) 
      [...] # Train the model on your new task
  </code></pre>