title: How to get a tensor's value in TensorFlow (without making another session)
body: <p>I'm finding a way to getting a tensor's value. In most case, the problem would be solved by calling "sess.run(target_op)". However, I want to know another way. I am editing the code downloaded from GitHub so there's already a session running code there. Without touching the session running part, is there any way to get some specific tensor value? In my case, the code is built for getting accuracy for image recognition. While session runs and doing the accuracy evaluation I also want to get "prediction" tensor value in the same session without creating another session. For example, an operation like tf.Print shows tensor value througha terminal window without running session directly(in the first figure we just have to do sess.run(e) to print out tensor from c)
  <a href="https://i.stack.imgur.com/Eyj2D.png" rel="nofollow noreferrer">example of tf.Print</a></p>
  
  <pre><code>a = tf.constant(5)
  b = tf.constant(3)
  c = tf.add(a,b)
  
  #print tensor c (which is 8)
  d = tf.Print(c,[c])
  f = tf.constant(2)
  e = tf.multiply(f,d)
  sess = tf.Session()
  
  #print operation can be executed without running the session directly
  g = sess.run(e)`
  </code></pre>
  
  <p>Like the tf.Print is there any operation that gets tensor value without running session directly? (like the second figure)
  <a href="https://i.stack.imgur.com/atjtt.png" rel="nofollow noreferrer">example of operation I am looking for</a></p>
  
  <p>More specifically, what I want is to get the value of tensor(with actual numbers and arrays, not just 'tensor' data structure)and pass it to the global variable to access the value freely even after the session closes. The session only executes the operator which is located at end of the graph while the tensor I want the value is located in the middle of the graph. With restriction that I cannot create more session than the original code has, is there any way to get the specific tensor value?( I can't use .eval() or .run() because either needs to access 'session'. the code I am editing runs the code by using slim.evaluate_once function and as session() is binded to the function, I cannot approach to session())</p>