tf.contrib.training.SummaryAtEndHook

Class SummaryAtEndHook

Inherits From: SessionRunHook

Defined in tensorflow/contrib/training/python/training/evaluation.py.

A run hook that saves a summary with the results of evaluation.

Methods

__init__

__init__(
    log_dir=None,
    summary_writer=None,
    summary_op=None,
    feed_dict=None
)

Constructs the Summary Hook.

Args:

  • log_dir: The directory where the summary events are saved to. Used only when summary_writer is not specified.
  • summary_writer: A tf.summary.FileWriter to write summary events with.
  • summary_op: The summary op to run. If left as None, then all summaries in the tf.GraphKeys.SUMMARIES collection are used.
  • feed_dict: An optional feed dictionary to use when evaluating the summaries.

Raises:

  • ValueError: If both log_dir and summary_writer are None.

after_create_session

after_create_session(
    session,
    coord
)

after_run

after_run(
    run_context,
    run_values
)

Called after each call to run().

The run_values argument contains results of requested ops/tensors by before_run().

The run_context argument is the same one send to before_run call. run_context.request_stop() can be called to stop the iteration.

If session.run() raises any exceptions then after_run() is not called.

Args:

  • run_context: A SessionRunContext object.
  • run_values: A SessionRunValues object.

before_run

before_run(run_context)

Called before each call to run().

You can return from this call a SessionRunArgs object indicating ops or tensors to add to the upcoming run() call. These ops/tensors will be run together with the ops/tensors originally passed to the original run() call. The run args you return can also contain feeds to be added to the run() call.

The run_context argument is a SessionRunContext that provides information about the upcoming run() call: the originally requested op/tensors, the TensorFlow Session.

At this point graph is finalized and you can not add ops.

Args:

  • run_context: A SessionRunContext object.

Returns:

None or a SessionRunArgs object.

begin

begin()

end

end(session)