Created
February 12, 2020 21:12
-
-
Save JossWhittle/99f89d0efa01b0e536d401a3ad28bee3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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