Home | History | Annotate | only in /external/tensorflow/tensorflow/contrib/hooks
Up to higher level directory
NameDateSize
__init__.py22-Oct-20201.1K
BUILD22-Oct-2020573
python/22-Oct-2020
README.md22-Oct-20201.1K

README.md

      1 # TensorFlow Experimental SessionRunHooks
      2 
      3 These hooks complement those in tensorflow/python/training. They are instances
      4 of `SessionRunHook` and are to be used with helpers like `MonitoredSession`
      5 and `learn.Estimator` that wrap `tensorflow.Session`.
      6 
      7 The hooks are called between invocations of `Session.run()` to perform custom
      8 behavior.
      9 
     10 For example the `ProfilerHook` periodically collects `RunMetadata` after
     11 `Session.run()` and saves profiling information that can be viewed in a
     12 neat timeline through a Chromium-based web browser (via
     13 [about:tracing](chrome://tracing)) or the standalone [Catapult](https://github.com/catapult-project/catapult/blob/master/tracing/README.md) tool.
     14 
     15 ```python
     16 from tensorflow.contrib.hooks import ProfilerHook
     17 
     18 hooks = [ProfilerHook(save_secs=30, output_dir="profiling")]
     19 with SingularMonitoredSession(hooks=hooks) as sess:
     20   while not sess.should_stop():
     21     sess.run(some_op)
     22 ```
     23 
     24 Or similarly with contrib.learn:
     25 
     26 ```python
     27 hooks = [ProfilerHook(save_steps=10, output_dir="profiling")]
     28 estimator = learn.Estimator(...)
     29 estimator.fit(input_fn, monitors=hooks)
     30 ```
     31