Add stats to json and dump to disk. Note that this method is idempotent.
(self)
| 385 | self._stat_now[name] = val |
| 386 | |
| 387 | def _trigger(self): |
| 388 | """ |
| 389 | Add stats to json and dump to disk. |
| 390 | Note that this method is idempotent. |
| 391 | """ |
| 392 | if len(self._stat_now): |
| 393 | self._stat_now['epoch_num'] = self.epoch_num |
| 394 | self._stat_now['global_step'] = self.global_step |
| 395 | |
| 396 | self._stats.append(self._stat_now) |
| 397 | self._stat_now = {} |
| 398 | self._write_stat() |
| 399 | |
| 400 | def _write_stat(self): |
| 401 | tmp_filename = self._fname + '.tmp' |
no test coverage detected