tf.compat.v1.train.MonitoredSession

Session-like object that handles initialization, recovery and hooks.

Migrate to TF2

This API is not compatible with eager execution and tf.function. To migrate to TF2, rewrite the code to be compatible with eager execution. Check the migration guide on replacing Session.run calls. In Keras, session hooks can be replaced by Callbacks e.g. logging hook notebook For more details please read Better performance with tf.function.