Python tensorflow.python.training.basic_session_run_hooks.SummarySaverHook() Examples
The following are 1
code examples of tensorflow.python.training.basic_session_run_hooks.SummarySaverHook().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.training.basic_session_run_hooks
, or try the search function
.
Example #1
Source File: monitored_session.py From deep_image_model with Apache License 2.0 | 4 votes |
def MonitoredTrainingSession(master='', # pylint: disable=invalid-name is_chief=True, checkpoint_dir=None, hooks=None, scaffold=None, config=None): """Creates a `MonitoredSession` for training. For a chief, this utility sets proper session initializer/restorer. It also creates hooks related to checkpoint and summary saving. For workers, this utility sets proper session creator which waits for the chief to inialize/restore. Args: master: `String` the TensorFlow master to use. is_chief: If `True`, it will take care of initialization and recovery the underlying TensorFlow session. If `False`, it will wait on a chief to initialize or recover the TensorFlow session. checkpoint_dir: A string. Optional path to a directory where to restore variables. hooks: Optional list of `SessionRunHook` objects. scaffold: A `Scaffold` used for gathering or building supportive ops. If not specified, a default one is created. It's used to finalize the graph. config: `ConfigProto` proto used to configure the session. Returns: A `MonitoredSession` object. """ hooks = hooks or [] scaffold = scaffold or Scaffold() if not is_chief: session_creator = WorkerSessionCreator( scaffold=scaffold, master=master, config=config) else: session_creator = ChiefSessionCreator( scaffold=scaffold, checkpoint_dir=checkpoint_dir, master=master, config=config) hooks.extend([ basic_session_run_hooks.StepCounterHook(output_dir=checkpoint_dir), basic_session_run_hooks.SummarySaverHook( scaffold=scaffold, save_steps=100, output_dir=checkpoint_dir), basic_session_run_hooks.CheckpointSaverHook( checkpoint_dir, save_secs=600, scaffold=scaffold), ]) return MonitoredSession(session_creator=session_creator, hooks=hooks)