title: How to get hidden layer output in tf.estimator.Estimator
body: <p>For example, I have the following code:</p>
  
  <pre><code>def model_fn(features, labels, mode, params):
    """Model function for Estimator."""
  
    first_hidden_layer = tf.layers.dense(features["x"], 10, activation=tf.nn.relu)
    second_hidden_layer = tf.layers.dense(first_hidden_layer, 10, activation=tf.nn.relu)
  
    output_layer = tf.layers.dense(second_hidden_layer, 1)
  
    predictions = tf.reshape(output_layer, [-1])
  
    loss = tf.losses.mean_squared_error(labels, predictions)
  
    optimizer = tf.train.GradientDescentOptimizer(
        learning_rate=params["learning_rate"])
    train_op = optimizer.minimize(
        loss=loss, global_step=tf.train.get_global_step())
  
    return tf.estimator.EstimatorSpec(
        mode=mode,
        loss=loss,
        train_op=train_op,export_outputs=export_outputs)
  
  train_input_fn = tf.estimator.inputs.numpy_input_fn(
    x={"x": np.array(training_set.data)},
    y=np.array(training_set.target),
    num_epochs=None,
    shuffle=True)
  
  nn.train(input_fn=train_input_fn, steps=100)
  </code></pre>
  
  <p>How can i get the output value of "second_hidden_layer", not the tensor but the real value? I have tried to use this code but failed.</p>
  
  <pre><code>export_outputs = {"en_out": tf.estimator.export.RegressionOutput( second_hidden_layer)}
  </code></pre>