Provide a scope for running one batch.
(self, step=0, mode=ModeKeys.TRAIN, size=1)
| 701 | |
| 702 | @tf_contextlib.contextmanager |
| 703 | def on_batch(self, step=0, mode=ModeKeys.TRAIN, size=1): |
| 704 | """Provide a scope for running one batch.""" |
| 705 | batch_logs = {'batch': step, 'size': size} |
| 706 | self.callbacks._call_batch_hook( |
| 707 | mode, 'begin', step, batch_logs) |
| 708 | self.progbar.on_batch_begin(step, batch_logs) |
| 709 | try: |
| 710 | yield batch_logs |
| 711 | finally: |
| 712 | if not batch_logs.pop('data_exhausted', False): |
| 713 | self.callbacks._call_batch_hook( |
| 714 | mode, 'end', step, batch_logs) |
| 715 | self.progbar.on_batch_end(step, batch_logs) |
no test coverage detected