title: "Cannot evaluate tensor using `eval()`: No default session is registered" while using custom SessionRunHook with Estimator API
body: <p>I'm following <a href="https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/convolutional_network.ipynb" rel="nofollow noreferrer">this example</a> in order to learn how to build a TensorFlow's CNN using Estimator API. In the given example there is a line <code>pred_probas = tf.nn.softmax(logits_test)</code> which would be highly valuable for me if I could obtain those probabilities since I'd like to use them in this small code snippet I wrote:</p>
  
  <pre><code>def eer_eval(y_true, probas):
      fpr, tpr, thresholds = roc_curve(y_true.eval(), probas[:, 1].eval())
      return brentq(lambda x: 1. - x - interp1d(fpr, tpr)(x), 0., 1.)
  </code></pre>
  
  <p>After reading <a href="https://stackoverflow.com/questions/45532365/is-there-any-tutorial-for-tf-trian-sessionrunhook">this post</a> I wrote my own hook</p>
  
  <pre><code>class _EERHook(tf.train.SessionRunHook):
      def __init__(self, probas, labels):
          self.labels = labels
          self.probas = probas
  
      def begin(self):
          pass
  
      def before_run(self, run_context):
          return tf.train.SessionRunArgs(eer_eval(self.labels, self.probas))
  
      def after_run(self,
                  run_context,  # pylint: disable=unused-argument
                  run_values):
          eer = run_values.results
          print("EER: ", eer)
  </code></pre>
  
  <p>which I'd like to use during the evaluation of the model</p>
  
  <pre><code>estim_specs = tf.estimator.EstimatorSpec(
          mode=mode,
          predictions=pred_classes,
          loss=loss_op,
          train_op=train_op,
          eval_metric_ops={'accuracy': acc_op},
          evaluation_hooks=[_EERHook(pred_probas, labels)])
  </code></pre>
  
  <p>However, the code crashes with the error</p>
  
  <pre><code>ValueError: Cannot evaluate tensor using `eval()`: No default session is registered. Use `with sess.as_default()` or pass an explicit session to `eval(session=sess)`
  </code></pre>
  
  <p>Is there any way I could save those probabilities to a human-readable csv file during evaluation or make my code snippet work?</p>