Type SessionManager
Namespace tensorflow.train
Parent PythonObjectContainer
Interfaces ISessionManager
Training helper that restores from checkpoint and creates session. This class is a small wrapper that takes care of session creation and
checkpoint recovery. It also provides functions that to facilitate
coordination among multiple training threads or processes. * Checkpointing trained variables as the training progresses.
* Initializing variables on startup, restoring them from the most recent
checkpoint after a crash, or wait for checkpoints to become available. ### Usage:
`prepare_session()` initializes or restores a model. It requires `init_op`
and `saver` as an argument. A second process could wait for the model to be ready by doing the following:
`wait_for_session()` waits for a model to be initialized by other processes.
Show Example
with tf.Graph().as_default(): ...add operations to the graph... # Create a SessionManager that will checkpoint the model in '/tmp/mydir'. sm = SessionManager() sess = sm.prepare_session(master, init_op, saver, checkpoint_dir) # Use the session to train the graph. while True: sess.run()
Methods
- NewDyn
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session
- prepare_session_dyn
- recover_session
- recover_session_dyn
- wait_for_session
- wait_for_session
- wait_for_session_dyn
Properties
Public instance methods
Session prepare_session(string master, IEnumerable<object> init_op, IEnumerable<object> saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IEnumerable<object>
init_op - Optional `Operation` used to initialize the model.
-
IEnumerable<object>
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, object init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, object init_op, int saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
init_op - Optional `Operation` used to initialize the model.
-
int
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, Operation init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
Operation
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, object init_op, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
init_op - Optional `Operation` used to initialize the model.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, Operation init_op, int saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
Operation
init_op - Optional `Operation` used to initialize the model.
-
int
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IGraphNodeBase init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IGraphNodeBase
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, Operation init_op, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
Operation
init_op - Optional `Operation` used to initialize the model.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IGraphNodeBase init_op, int saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IGraphNodeBase
init_op - Optional `Operation` used to initialize the model.
-
int
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, object init_op, IEnumerable<object> saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
init_op - Optional `Operation` used to initialize the model.
-
IEnumerable<object>
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IGraphNodeBase init_op, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IGraphNodeBase
init_op - Optional `Operation` used to initialize the model.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IEnumerable<object> init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IEnumerable<object>
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IGraphNodeBase init_op, IEnumerable<object> saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IGraphNodeBase
init_op - Optional `Operation` used to initialize the model.
-
IEnumerable<object>
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, int init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
int
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IEnumerable<object> init_op, int saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IEnumerable<object>
init_op - Optional `Operation` used to initialize the model.
-
int
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, int init_op, int saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
int
init_op - Optional `Operation` used to initialize the model.
-
int
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, IEnumerable<object> init_op, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
IEnumerable<object>
init_op - Optional `Operation` used to initialize the model.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, int init_op, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
int
init_op - Optional `Operation` used to initialize the model.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, Operation init_op, IEnumerable<object> saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
Operation
init_op - Optional `Operation` used to initialize the model.
-
IEnumerable<object>
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
Session prepare_session(string master, int init_op, IEnumerable<object> saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config, IDictionary<object, object> init_feed_dict, PythonFunctionContainer init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
int
init_op - Optional `Operation` used to initialize the model.
-
IEnumerable<object>
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
IDictionary<object, object>
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
PythonFunctionContainer
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
Session
- A `Session` object that can be used to drive the model.
object prepare_session_dyn(object master, object init_op, object saver, object checkpoint_dir, object checkpoint_filename_with_path, ImplicitContainer<T> wait_for_checkpoint, ImplicitContainer<T> max_wait_secs, object config, object init_feed_dict, object init_fn)
Creates a `Session`. Makes sure the model is ready to be used. Creates a `Session` on 'master'. If a `saver` object is passed in, and
`checkpoint_dir` points to a directory containing valid checkpoint
files, then it will try to recover the model from checkpoint. If
no checkpoint files are available, and `wait_for_checkpoint` is
`True`, then the process would check every `recovery_wait_secs`,
up to `max_wait_secs`, for recovery to succeed. If the model cannot be recovered successfully then it is initialized by
running the `init_op` and calling `init_fn` if they are provided.
The `local_init_op` is also run after init_op and init_fn, regardless of
whether the model was recovered successfully, but only if
`ready_for_local_init_op` passes. If the model is recovered from a checkpoint it is assumed that all
global variables have been initialized, in particular neither `init_op`
nor `init_fn` will be executed. It is an error if the model cannot be recovered and no `init_op`
or `init_fn` or `local_init_op` are passed.
Parameters
-
object
master - `String` representation of the TensorFlow master to use.
-
object
init_op - Optional `Operation` used to initialize the model.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
ImplicitContainer<T>
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
ImplicitContainer<T>
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
-
object
init_feed_dict - Optional dictionary that maps `Tensor` objects to feed values. This feed dictionary is passed to the session `run()` call when running the init op.
-
object
init_fn - Optional callable used to initialize the model. Called after the optional `init_op` is called. The callable must accept one argument, the session being initialized.
Returns
-
object
- A `Session` object that can be used to drive the model.
ValueTuple<Session, bool> recover_session(string master, Saver saver, object checkpoint_dir, object checkpoint_filename_with_path, bool wait_for_checkpoint, int max_wait_secs, object config)
Creates a `Session`, recovering if possible. Creates a new session on 'master'. If the session is not initialized
and can be recovered from a checkpoint, recover it.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
Saver
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
bool
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
int
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
Returns
-
ValueTuple<Session, bool>
- A pair (sess, initialized) where 'initialized' is `True` if the session could be recovered and initialized, `False` otherwise.
object recover_session_dyn(object master, object saver, object checkpoint_dir, object checkpoint_filename_with_path, ImplicitContainer<T> wait_for_checkpoint, ImplicitContainer<T> max_wait_secs, object config)
Creates a `Session`, recovering if possible. Creates a new session on 'master'. If the session is not initialized
and can be recovered from a checkpoint, recover it.
Parameters
-
object
master - `String` representation of the TensorFlow master to use.
-
object
saver - A `Saver` object used to restore a model.
-
object
checkpoint_dir - Path to the checkpoint files. The latest checkpoint in the dir will be used to restore.
-
object
checkpoint_filename_with_path - Full file name path to the checkpoint file.
-
ImplicitContainer<T>
wait_for_checkpoint - Whether to wait for checkpoint to become available.
-
ImplicitContainer<T>
max_wait_secs - Maximum time to wait for checkpoints to become available.
-
object
config - Optional `ConfigProto` proto used to configure the session.
Returns
-
object
- A pair (sess, initialized) where 'initialized' is `True` if the session could be recovered and initialized, `False` otherwise.
Session wait_for_session(string master, object config, ImplicitContainer<T> max_wait_secs)
Creates a new `Session` and waits for model to be ready. Creates a new `Session` on 'master'. Waits for the model to be
initialized or recovered from a checkpoint. It's expected that
another thread or process will make the model ready, and that this
is intended to be used by threads/processes that participate in a
distributed training configuration where a different thread/process
is responsible for initializing or recovering the model being trained. NB: The amount of time this method waits for the session is bounded
by max_wait_secs. By default, this function will wait indefinitely.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
config - Optional ConfigProto proto used to configure the session.
-
ImplicitContainer<T>
max_wait_secs - Maximum time to wait for the session to become available.
Returns
-
Session
- A `Session`. May be None if the operation exceeds the timeout specified by config.operation_timeout_in_ms.
Session wait_for_session(string master, object config, int max_wait_secs)
Creates a new `Session` and waits for model to be ready. Creates a new `Session` on 'master'. Waits for the model to be
initialized or recovered from a checkpoint. It's expected that
another thread or process will make the model ready, and that this
is intended to be used by threads/processes that participate in a
distributed training configuration where a different thread/process
is responsible for initializing or recovering the model being trained. NB: The amount of time this method waits for the session is bounded
by max_wait_secs. By default, this function will wait indefinitely.
Parameters
-
string
master - `String` representation of the TensorFlow master to use.
-
object
config - Optional ConfigProto proto used to configure the session.
-
int
max_wait_secs - Maximum time to wait for the session to become available.
Returns
-
Session
- A `Session`. May be None if the operation exceeds the timeout specified by config.operation_timeout_in_ms.
object wait_for_session_dyn(object master, object config, ImplicitContainer<T> max_wait_secs)
Creates a new `Session` and waits for model to be ready. Creates a new `Session` on 'master'. Waits for the model to be
initialized or recovered from a checkpoint. It's expected that
another thread or process will make the model ready, and that this
is intended to be used by threads/processes that participate in a
distributed training configuration where a different thread/process
is responsible for initializing or recovering the model being trained. NB: The amount of time this method waits for the session is bounded
by max_wait_secs. By default, this function will wait indefinitely.
Parameters
-
object
master - `String` representation of the TensorFlow master to use.
-
object
config - Optional ConfigProto proto used to configure the session.
-
ImplicitContainer<T>
max_wait_secs - Maximum time to wait for the session to become available.
Returns
-
object
- A `Session`. May be None if the operation exceeds the timeout specified by config.operation_timeout_in_ms.
Public static methods
SessionManager NewDyn(object local_init_op, object ready_op, object ready_for_local_init_op, object graph, ImplicitContainer<T> recovery_wait_secs, object local_init_run_options)
Creates a SessionManager. The `local_init_op` is an `Operation` that is run always after a new session
was created. If `None`, this step is skipped. The `ready_op` is an `Operation` used to check if the model is ready. The
model is considered ready if that operation returns an empty 1D string
tensor. If the operation returns a non empty 1D string tensor, the elements
are concatenated and used to indicate to the user why the model is not
ready. The `ready_for_local_init_op` is an `Operation` used to check if the model
is ready to run local_init_op. The model is considered ready if that
operation returns an empty 1D string tensor. If the operation returns a non
empty 1D string tensor, the elements are concatenated and used to indicate
to the user why the model is not ready. If `ready_op` is `None`, the model is not checked for readiness. `recovery_wait_secs` is the number of seconds between checks that
the model is ready. It is used by processes to wait for a model to
be initialized or restored. Defaults to 30 seconds.
Parameters
-
object
local_init_op - An `Operation` run immediately after session creation. Usually used to initialize tables and local variables.
-
object
ready_op - An `Operation` to check if the model is initialized.
-
object
ready_for_local_init_op - An `Operation` to check if the model is ready to run local_init_op.
-
object
graph - The `Graph` that the model will use.
-
ImplicitContainer<T>
recovery_wait_secs - Seconds between checks for the model to be ready.
-
object
local_init_run_options - RunOptions to be passed to session.run when executing the local_init_op.