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?
$\begingroup$
$\endgroup$
2
-
$\begingroup$ Do you mean weights of model by values? $\endgroup$– KavehMay 11, 2022 at 9:05
-
$\begingroup$ sorry I mean of getting the values of the metric (for instance accuracy) after each run/batch within an epoch. $\endgroup$– user135603May 11, 2022 at 11:27
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
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.