aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-07-08 16:49:51 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-08 16:54:41 -0700
commitd22c433216254d2e6ab33a849f922b4545d1f7dd (patch)
tree9b3ec1983d40f4f89aaaebe5e936d5054a187e02 /tensorflow
parent2662d4e80c4892fb283d1cc2181fe017a71c8516 (diff)
Fix typos in comments.
PiperOrigin-RevId: 161305803
Diffstat (limited to 'tensorflow')
-rw-r--r--tensorflow/python/training/monitored_session.py2
-rw-r--r--tensorflow/python/training/session_run_hook.py19
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()