<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def after_epoch(self, epoch_data: EpochData, **kwargs) -> None: """ If initialized to check after each epoch, stop the training once the epoch data contains a monitored variable equal to NaN. :param epoch_data: epoch data to be checked """


        if self._after_epoch:
            self._check_nan(epoch_data)