diff options
author | 2017-07-08 16:49:51 -0700 | |
---|---|---|
committer | 2017-07-08 16:54:41 -0700 | |
commit | d22c433216254d2e6ab33a849f922b4545d1f7dd (patch) | |
tree | 9b3ec1983d40f4f89aaaebe5e936d5054a187e02 /tensorflow | |
parent | 2662d4e80c4892fb283d1cc2181fe017a71c8516 (diff) |
Fix typos in comments.
PiperOrigin-RevId: 161305803
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/python/training/monitored_session.py | 2 | ||||
-rw-r--r-- | tensorflow/python/training/session_run_hook.py | 19 |
2 files changed, 13 insertions, 8 deletions
diff --git a/tensorflow/python/training/monitored_session.py b/tensorflow/python/training/monitored_session.py index e7b296374a..2feb6bd3c3 100644 --- a/tensorflow/python/training/monitored_session.py +++ b/tensorflow/python/training/monitored_session.py @@ -92,7 +92,7 @@ class Scaffold(object): * `init_feed_dict`: A session feed dictionary that should be used when running the init op. - * `init_fn`: A callable to run run after the init op to perform additional + * `init_fn`: A callable to run after the init op to perform additional initializations. The callable will be called as `init_fn(scaffold, session)`. diff --git a/tensorflow/python/training/session_run_hook.py b/tensorflow/python/training/session_run_hook.py index 09da63eb68..dbeabd250e 100644 --- a/tensorflow/python/training/session_run_hook.py +++ b/tensorflow/python/training/session_run_hook.py @@ -42,23 +42,28 @@ For more specific needs, you can create custom hooks: print('Starting the session.') self.your_tensor = ... - def end(self, session): - print('Done with the session.') + def after_create_session(self, session, coord): + # When this is called, the graph is finalized and + # ops can no longer be added to the graph. + print('Session created.') def before_run(self, run_context): - print('before calling session.run) + print('Before calling session.run().') return SessionRunArgs(self.your_tensor) - def after_run(self, run_context, run_values) + def after_run(self, run_context, run_values): print('Done running one step. The value of my tensor: %s', run_values.results) if you-need-to-stop-loop: run_context.request_stop() + def end(self, session): + print('Done with the session.') + To understand how hooks interact with calls to `MonitoredSession.run()`, look at following code: - with SupervisedSession(hooks=your_hooks, ...) as sess - while not sess.should_stop() + with MonitoredTrainingSession(hooks=your_hooks, ...) as sess: + while not sess.should_stop(): sess.run(your_fetches) Above user code leads to following execution: @@ -68,7 +73,7 @@ Above user code leads to following execution: while not stop is requested: call hooks.before_run() try: - results = sess.run(merged_fetches) + results = sess.run(merged_fetches, feed_dict=merged_feeds) except (errors.OutOfRangeError, StopIteration): break call hooks.after_run() |