run_one_step()# callbacks.{before,after}_run are hooked with session
self.run_step()# callbacks.{before,after}_run are hooked with session
callbacks.trigger_step()
callbacks.trigger_step()
callbacks.after_epoch()
callbacks.after_epoch()
callbacks.trigger_epoch()
callbacks.trigger_epoch()
...
@@ -87,6 +89,7 @@ to let this method run every k steps or every k epochs.
...
@@ -87,6 +89,7 @@ to let this method run every k steps or every k epochs.
### What you can do in the callback
### What you can do in the callback
* Access tensors / ops in either training / inference mode (need to create them in `_setup_graph`).
* Access tensors / ops in either training / inference mode (need to create them in `_setup_graph`).
To create a callable function under inference mode, use `self.trainer.get_predictor`.
* Write stuff to the monitor backend, by `self.trainer.monitors.put_xxx`.
* Write stuff to the monitor backend, by `self.trainer.monitors.put_xxx`.
The monitors might direct your events to TensorFlow events file, JSON file, stdout, etc.
The monitors might direct your events to TensorFlow events file, JSON file, stdout, etc.
You can get history monitor data as well. See the docs for [Monitors](http://tensorpack.readthedocs.io/en/latest/modules/callbacks.html#tensorpack.callbacks.Monitors)
You can get history monitor data as well. See the docs for [Monitors](http://tensorpack.readthedocs.io/en/latest/modules/callbacks.html#tensorpack.callbacks.Monitors)