Adds the provided hooks to this session wrapper.
Adds the provided hooks to this session wrapper. Note that the begin()
method of these hooks may not be called
given that they are added in an existing session and not provided in its constructor.
Releases the native resources associated with this object.
Releases the native resources associated with this object.
Function used to delete the native server object (i.e., free relevant memory).
Returns a boolean flag indicating whether this session has been closed.
Returns a boolean flag indicating whether this session has been closed.
Removes the provided hooks from this session wrapper.
Resets the shouldStop
flag of this session wrapper to false
.
Runs ops and evaluates tensors in fetches
, and returns the values of the evaluated tensors.
Runs ops and evaluates tensors in fetches
, and returns the values of the evaluated tensors.
This method runs one "step" of TensorFlow computation, by running the necessary graph fragment to execute every
Op
and evaluate every Output
in fetches
, substituting the values in feeds
for the corresponding input
values.
Optional feed map. This argument can be used to feed values into a TensorFlow session. It is a map from graph nodes to their corresponding Tensor values. More specifically, for all allowed types for this argument, please refer to the documentation of the Feedable type class.
Optional argument specifying which values to fetch from the TensorFlow session. This argument can have various forms and its type defines the return type of this function. Please refer to the documentation of the Fetchable type class for details on the allowed types.
Optional argument specifying which ops to execute in the TensorFlow graph, without returning their
value. Please refer to the documentation of the Executable type class for details on the
allowed types of targets
.
Optional RunOptions protocol buffer that allows controlling the behavior of this particular run (e.g., turning tracing on).
The evaluated tensors using the structure of fetches
. For more details on the return type, please refer
to the documentation of the Fetchable type class.
IllegalStateException
If this session has already been closed.
Runs ops and evaluates tensors in fetches
, and returns the values of the evaluated tensors, along with any run
metadata that may have been collected.
Runs ops and evaluates tensors in fetches
, and returns the values of the evaluated tensors, along with any run
metadata that may have been collected.
This method runs one "step" of TensorFlow computation, by running the necessary graph fragment to execute every
Op and evaluate every Output in fetches
, substituting the values in feeds
for the corresponding input
values.
When appropriate (e.g., when users turn on tracing in options
), the run metadata output of this run will be
collected in a RunMetadata protocol buffer and returned by this function.
Optional feed map. This argument can be used to feed values into a TensorFlow session. It is a map from graph nodes to their corresponding Tensor values. More specifically, for all allowed types for this argument, please refer to the documentation of the Feedable type class.
Optional argument specifying which values to fetch from the TensorFlow session. This argument can have various forms and its type defines the return type of this function. Please refer to the documentation of the Fetchable type class for details on the allowed types.
Optional argument specifying which ops to execute in the TensorFlow graph, without returning their
value. Please refer to the documentation of the Executable type class for details on the
allowed types of targets
.
Optional RunOptions protocol buffer that allows controlling the behavior of this particular run (e.g., turning tracing on).
A tuple containing two elements:
fetches
. For more details on the return type, please
refer to the documentation of the Fetchable type class.IllegalStateException
If the session has already been closed.
Session being wrapped.
Session being wrapped.
Returns true
if this session should not be used anymore.
Returns true
if this session should not be used anymore. This method always return true
if the session has
been closed already.
Process to which this session will connect.
Process to which this session will connect.
Wrapper around a Session that invokes Hook callbacks before and after calls to
Session.run()
.This wrapper is used as a base class for various session wrappers that provide additional functionality such as monitoring and recovery.
In addition to the methods provided by Session the wrapper provides a method to check for requested stops and never throws any exceptions thrown by calls to
Session.close
.The list of hooks to call is passed in the constructor. Before each call to
Session.run()
the session calls theHook.beforeSessionRun()
method of each hook, which can return additional ops or tensors to run. These are added to the arguments of the call toSession.run()
.When the
Session.run()
call finishes, the session invokes theHook.afterSessionRun()
method of each hook, passing the values returned by theSession.run()
call corresponding to the ops and tensors that each hook requested.If any call to the hooks requests a stop via the
runContext
, the session will be marked as needing to stop and itsshouldStop()
method will then returntrue
.