org.platanios.tensorflow.api.learn.hooks
If true
, the step rate is logged using the current logging configuration.
If provided, summaries for the step rate will be saved in this directory. This is useful for visualization using TensorBoard, for example.
Hook trigger specifying when this hook is triggered (i.e., when it executes). If you only want
to trigger this hook at the end of a run and not during, then you should set trigger
to
NoHookTrigger and triggerAtEnd
to true
.
If true
, the hook will be triggered at the end of the run. Note that if this flag is set to
true
, then the global step must be computable without using a feed map for the
Session.run() call (which should always be the case by default).
Tag to use for the step rate when logging and saving summaries.
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.
If true
, the step rate is logged using the current logging configuration.
If provided, summaries for the step rate will be saved in this directory.
If provided, summaries for the step rate will be saved in this directory. This is useful for visualization using TensorBoard, for example.
Tag to use for the step rate when logging and saving summaries.
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 trigger this hook at the end of a run and not during, then you should set trigger
to
NoHookTrigger and triggerAtEnd
to true
.
If true
, the hook will be triggered at the end of the run.
If true
, the hook will be triggered at the end of the run. Note that if this flag is set to
true
, then the global step must be computable without using a feed map for the
Session.run() call (which should always be the case by default).
Saves summaries to files based on a HookTrigger.