code: def _trigger(self):
          
          if len(self._stat_now):
              self._stat_now['epoch_num'] = self.epoch_num
              self._stat_now['global_step'] = self.global_step
  
              self._stats.append(self._stat_now)
              self._stat_now = {}
              self._write_stat()
docs: Add stats to json and dump to disk.
          Note that this method is idempotent.