Prints the given tensors every N local steps, every N seconds, or at end.

Inherits From: SessionRunHook

The tensors will be printed to the log, with INFO severity. If you are not seeing the logs, you might want to add the following line after your imports:


Note that if at_end is True, tensors should not include any tensor whose evaluation produces a side effect such as consuming additional inputs.

tensors dict that maps string-valued tags to tensors/tensor names, or iterable of tensors/tensor names.
every_n_iter int, print the values of tensors once every N local steps taken on the current worker.
every_n_secs int or float, print the values of tensors once every N seconds. Exactly one of every_n_iter and every_n_secs should be provided.
at_end bool specifying whether to print the values of tensors at the end of the run.
formatter function, takes dict of tag->Tensor and returns a string. If None uses default printing all tensors.

ValueError if every_n_iter is non-positive.



View source

Called when new TensorFlow session is created.

This is called to signal the hooks that a new session has been created. This has two essential differences with the situation in which begin is called:

  • When this is called, the graph is finalized and ops can no longer be added to the graph.
  • This method will also be called as a result of recovering a wrapped session, not only at the beginning of the overall session.

session A TensorFlow Session that has been created.
coord A Coordinator object which keeps track of all threads.


View source

Called after each call to run().

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