Computing expensive metrics less frequently than using validation_step()
Hi
I need to compute some metrics that are not quick to compute (eg. Frechet Inception Distance).
It is too expensive to compute them every validation epoch. Instead I would like to compute the metric once after every training epoch (or after some arbitrary number of steps). To do so, I need to be able to access the training dataset at the end of every training epoch, compute the metric and log it.
It is not obvious how to do this, as I cannot access the training data-set during “on_epoch_end” or one of the other end of epoch hooks.
Is there a good solution for this?
Thanks
Inigo.
Solved by using self.trainer.datamodule