title: Feed Variables in Tensorflow Efficiently
body: <p>I need to have a dictionary fed to a set of variables in Tensorflow and actually change their values. I tried: sess.run([], feed_dict=feed_dict), the run result was executed using the feed_dict, but the variable values are not updated. To update the values, I also tried doing "load" on each variable. That works, but is extremely inefficient. Loading a ~20 variables of 20M data takes 10s. I need it to be within 1s. (Feeding it only takes ~100ms) Is there a more efficient way to do this?</p>
  
  <p>Below is an example:</p>
  
  <pre><code>import tensorflow as tf
  import numpy as np
  
  variables = []
  for i in range(100):
      variables.append(tf.Variable(np.random.rand(100, 100)))
  
  sess = tf.Session()
  
  feed_dict = dict()
  for var in variables:
      feed_dict[var] = np.ones((100, 100))
  
  sess.run(tf.initialize_all_variables())
  
  
  
  # this is fast but do not actaully load variables (~ 14ms)
  sess.run(variables, feed_dict=feed_dict)
  
  # this loads, but is extremely slow (~8s)
  data = np.ones((100, 100))
  for var in variables:
      var.load(data, sess)
  </code></pre>