title: Tensorflow: How to replace a node in a calculation graph?
body: <p>If you have two disjoint graphs, and want to link them, turning this:</p>
  
  <pre><code>x = tf.placeholder('float')
  y = f(x)
  
  y = tf.placeholder('float')
  z = f(y)
  </code></pre>
  
  <p>into this:</p>
  
  <pre><code>x = tf.placeholder('float')
  y = f(x)
  z = g(y)
  </code></pre>
  
  <p>Is there a way to do that? It seems like it could make construction easier in some cases. </p>
  
  <p>For example if you have a graph that has the input image as a <code>tf.placeholder</code>, and want to optimize the input image, deep-dream style, is there a way to just replace the placeholder with a <code>tf.variable</code> node? Or do you have to think of that before building the graph?</p>