org.platanios.tensorflow.api.learn.hooks
Directory in which to create the trace file. The file will be named trace{step}.json
. Note
that this hook will overwrite any existing files with that name, in this directory.
If true
, add flow events to the trace connecting producers and consumers of tensors.
If true
, add object snapshot events to the trace showing sizes and lifetimes of tensors.
If true
, produces human-readable JSON output.
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.
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
, produces human-readable JSON output.
If true
, add flow events to the trace connecting producers and consumers of tensors.
If true
, add object snapshot events to the trace showing sizes and lifetimes of tensors.
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.
Directory in which to create the trace file.
Directory in which to create the trace file. The file will be named trace{step}.json
. Note
that this hook will overwrite any existing files with that name, in this directory.
Hook that saves Chrome trace files for visualizing execution timelines of TensorFlow steps.