Skip to content

Instantly share code, notes, and snippets.

View FHermisch's full-sized avatar

Florian FHermisch

View GitHub Profile
@SiLiKhon
SiLiKhon / activation_monitoring_callback.py
Last active May 2, 2021 14:26
Ugly code to monitor layer activations when training tf keras models with `model.fit` or similar.
# Disclaimer: this is just an ugly solution to monitoring layer activations
# when training a model in tf keras.
# this code is executed right after the model is created.
class Callback(tf.keras.callbacks.Callback):
def __init__(self, logging_data):
super().__init__()
# `logging_data` is a namedtuple of the follwoing type:
# LoggingData = namedtuple("LoggingData", ['get_val_dataset_fn', 'get_writer_fn', 'freq'])