See the guide: Training > Training Hooks
Prints the given tensors every N local steps, every N seconds, or at end.
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.
__init__( tensors, every_n_iter=None, every_n_secs=None, at_end=False, formatter=None )
dictthat maps string-valued tags to tensors/tensor names, or
iterableof tensors/tensor names.
int, print the values of
tensorsonce every N local steps taken on the current worker.
float, print the values of
tensorsonce every N seconds. Exactly one of
every_n_secsshould be provided.
boolspecifying whether to print the values of
tensorsat the end of the run.
formatter: function, takes dict of
Tensorand returns a string. If
Noneuses default printing all tensors.
after_create_session( session, coord )
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.
after_run( run_context, run_values )