0
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ Do you mean weights of model by values? $\endgroup$
    – Kaveh
    May 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$
    – user135603
    May 11, 2022 at 11:27

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.