Keras Callback to save all the values of each batch per epoch

I would like to gather all the values during training for each epoch. When using the fit function of tensorflow I only receive the last value after run through all batches. One of my ideas would be to use GradientTape for this but maybe there is a easier way to do so using a callback. Does anybody have an idea how to obtain the store the result for each batch?

Topic tensorflow python

Category Data Science


The checkpoint callback may provide what you want. The monitor parameter allows you to specify which metrics to report and the save_freq parameter specifies the frequency. The latter defaults to epoch, but you can specify an integer instead, which specifies the number of batches between checkpoints. The object returned by the fit method includes a history attribute that contains the metrics at each checkpoint.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.