title: How to show hidden layer outputs in Tensorflow
body: <p>I'm having differences of the outputs when comparing a model with its stored protobuf version (via <a href="https://github.com/amir-abdi/keras_to_tensorflow/blob/master/keras_to_tensorflow.py" rel="nofollow noreferrer">this conversion script</a>). For debugging I'm comparing both layers respectively. For the weights and the actual layer output during a test sequence I receive the identical outputs, thus I'm not sure how to access the hidden layers.</p>
  
  <p>Here is how I load the layers </p>
  
  <pre><code>    input  = graph.get_tensor_by_name("lstm_1_input_1:0")
      layer1 = graph.get_tensor_by_name("lstm_1_1/kernel:0")
      layer2 = graph.get_tensor_by_name("lstm_1_1/recurrent_kernel:0")
      layer3 = graph.get_tensor_by_name("time_distributed_1_1/kernel:0")
      output = graph.get_tensor_by_name("activation_1_1/div:0")
  </code></pre>
  
  <p>Here is the way what I thought to show the respective elements.</p>
  
  <p><strong>show weights</strong>:</p>
  
  <pre><code>with tf.Session(graph=graph) as sess:
         print sess.run(layer1)
         print sess.run(layer2)
         print sess.run(layer3)
  </code></pre>
  
  <p><strong>show outputs</strong>:</p>
  
  <pre><code>with tf.Session(graph=graph) as sess:
      y_out, l1_out, l2_out, l3_out = sess.run([output, layer1, layer2, layer3], feed_dict={input: X_test})
  </code></pre>
  
  <p>With this code <code>sess.run(layer1) == sess.run(layer1,feed_dict={input:X_test})</code> which shouldn't be true.</p>
  
  <p>Can someone help me out?</p>