If true
, the loss will also be logged at the INFO
level, using the current logging
configuration.
Summary directory to use optionally, for saving scalar summaries of the loss. These can be useful for visualizing training using TensorBoard.
Hook trigger specifying when this hook is triggered (i.e., when it executes). If you only want
to log the tensor values at the end of a run and not during, then you should set trigger
to
NoHookTrigger and logAtEnd
to true
.
If true
, this hook will be triggered at the end of the run. Note that if this flag is set to
true
, then tensors
must be computable without using a feed map for the Session.run()
call.
Function used to format the message that is being logged. It takes the time taken since the last logged message, the current step, and the current loss value, as input, and returns a string to log.
Called after a new session is created.
Called after a new session is created. This is called to signal the hooks that a new session has been created.
This callback has two essential differences with the situation in which begin()
is called:
The session that has been created.
Called after each call to Session.run()
.
Called after each call to Session.run()
.
The runContext
argument is the same one passed to beforeSessionRun()
. runContext.requestStop()
can be called
to stop the iteration.
The runResult
argument contains fetched values for the tensors requested by beforeSessionRun()
.
If Session.run()
throws any exception, then afterSessionRun()
will not be called. Note the difference between
the end()
and the afterSessionRun()
behavior when Session.run()
throws an OutOfRangeException. In
that case, end()
is called but afterSessionRun()
is not called.
Provides information about the run call (i.e., the originally requested ops/tensors, the
session, etc.). Same value as that passed to beforeSessionRun
.
Result of the Session.run()
call that includes the fetched values for the tensors requested
by beforeSessionRun()
.
Called before each call to Session.run()
.
Called before each call to Session.run()
. You can return from this call a Hook.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 arguments you return can also contain feeds to be
added to the run call.
The runContext
argument is a Hook.SessionRunContext that provides information about the upcoming run call
(i.e., the originally requested ops/tensors, the session, etc.).
At this point the graph is finalized and you should not add any new ops.
Provides information about the upcoming run call (i.e., the originally requested ops/tensors, the session, etc.).
Called once before creating the session.
Called once before creating the session. When called, the default graph is the one that will be launched in the
session. The hook can modify the graph by adding new operations to it. After the begin
call the graph will be
finalized and the other callbacks will not be able to modify the graph anymore. A second begin
call on the same
graph, should not change that graph.
Called at the end of the session usage (i.e., Session.run()
will not be invoked again after this call).
Called at the end of the session usage (i.e., Session.run()
will not be invoked again after this call).
The session
argument can be used in case the hook wants to execute any final ops, such as saving a last
checkpoint.
If Session.run()
throws any exception other than OutOfRangeException then end()
will not be called.
Note the difference between the end()
and the afterSessionRun()
behavior when Session.run()
throws an
OutOfRangeException. In that case, end()
is called but afterSessionRun()
is not called.
Session that will not be used again after this call.
Function used to format the message that is being logged.
Function used to format the message that is being logged. It takes the time taken since the last logged message, the current step, and the current loss value, as input, and returns a string to log.
If true
, the loss will also be logged at the INFO
level, using the current logging
configuration.
Summary directory to use optionally, for saving scalar summaries of the loss.
Summary directory to use optionally, for saving scalar summaries of the loss. These can be useful for visualizing training using TensorBoard.
Hook trigger specifying when this hook is triggered (i.e., when it executes).
Hook trigger specifying when this hook is triggered (i.e., when it executes). If you only want
to log the tensor values at the end of a run and not during, then you should set trigger
to
NoHookTrigger and logAtEnd
to true
.
If true
, this hook will be triggered at the end of the run.
If true
, this hook will be triggered at the end of the run. Note that if this flag is set to
true
, then tensors
must be computable without using a feed map for the Session.run()
call.
Hook that logs the loss function value.