Skip to content

Instantly share code, notes, and snippets.

@JossWhittle
Created February 12, 2020 21:12
Show Gist options
  • Save JossWhittle/99f89d0efa01b0e536d401a3ad28bee3 to your computer and use it in GitHub Desktop.
Save JossWhittle/99f89d0efa01b0e536d401a3ad28bee3 to your computer and use it in GitHub Desktop.
class LoggingTensorBoard(tf.keras.callbacks.TensorBoard):
def __init__(self, log_dir):
super().__init__(log_dir=log_dir, update_freq='epoch', write_graph=True, profile_batch=2)
def on_epoch_end(self, epoch, logs=None):
logs = logs or {}
logs.update({
'learning_rate' : tf.keras.backend.eval(self.model.optimizer.lr),
'regularization' : tf.keras.backend.eval(sum(self.model.losses)),
})
super().on_epoch_end(epoch, logs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment