Skip to content

Instantly share code, notes, and snippets.

View himanshurawlani's full-sized avatar

Himanshu Rawlani himanshurawlani

View GitHub Profile
@himanshurawlani
himanshurawlani / tune_reporter_callback.py
Last active September 10, 2020 18:45
An example Keras callback to report metrics to Ray Tune after every epoch
class TuneReporter(tf.keras.callbacks.Callback):
"""Tune Callback for Keras."""
def __init__(self, reporter=None, freq="epoch", logs=None):
"""Initializer.
Args:
freq (str): Sets the frequency of reporting intermediate results.
"""
self.iteration = 0
logs = logs or {}