Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

TensorFlow Experimental SessionRunHooks

These hooks complement those in tensorflow/python/training. They are instances of SessionRunHook and are to be used with helpers like MonitoredSession and learn.Estimator that wrap tensorflow.Session.

The hooks are called between invocations of Session.run() to perform custom behaviour.

For example the ProfilerHook periodically collects RunMetadata after Session.run() and saves profiling information that can be viewed in a neat timeline through a Chromium-based web browser (via about:tracing) or the standalone Catapult tool.

from tensorflow.contrib.hooks import ProfilerHook

hooks = [ProfilerHook(save_secs=30, output_dir="profiling")]
with SingularMonitoredSession(hooks=hooks) as sess:
  while not sess.should_stop():
    sess.run(some_op)

Or similarly with contrib.learn:

hooks = [ProfilerHook(save_steps=10, output_dir="profiling")]
estimator = learn.Estimator(...)
estimator.fit(input_fn, monitors=hooks)