Lines Matching full:logs
190 def make_logs(model, logs, outputs, mode, prefix=''): argument
191 """Computes logs for sending to `on_batch_end` methods."""
195 logs[prefix + label] = output
197 logs['outputs'] = outputs
198 return logs
283 def _process_logs(self, logs, is_batch_hook=False): argument
285 if logs is None:
288 return logs
290 return logs
291 return tf_utils.sync_to_numpy_or_python_type(logs)
308 def _call_batch_hook(self, mode, hook, batch, logs=None): argument
314 self._call_batch_begin_hook(mode, batch, logs)
316 self._call_batch_end_hook(mode, batch, logs)
320 def _call_batch_begin_hook(self, mode, batch, logs): argument
323 self._call_batch_hook_helper(hook_name, batch, logs)
328 def _call_batch_end_hook(self, mode, batch, logs): argument
336 self._call_batch_hook_helper(hook_name, batch, logs)
366 def _call_batch_hook_helper(self, hook_name, batch, logs): argument
371 logs = self._process_logs(logs, is_batch_hook=True)
374 hook(batch, logs)
399 def on_batch_begin(self, batch, logs=None): argument
401 self._call_batch_hook(ModeKeys.TRAIN, 'begin', batch, logs=logs)
403 def on_batch_end(self, batch, logs=None): argument
405 self._call_batch_hook(ModeKeys.TRAIN, 'end', batch, logs=logs)
407 def on_epoch_begin(self, epoch, logs=None): argument
414 logs: Dict. Currently no data is passed to this argument for this method
417 logs = self._process_logs(logs)
419 callback.on_epoch_begin(epoch, logs)
421 def on_epoch_end(self, epoch, logs=None): argument
428 logs: Dict, metric results for this training epoch, and for the
432 logs = self._process_logs(logs)
434 callback.on_epoch_end(epoch, logs)
436 def on_train_batch_begin(self, batch, logs=None): argument
441 logs: Dict, contains the return value of `model.train_step`. Typically,
446 self._call_batch_hook(ModeKeys.TRAIN, 'begin', batch, logs=logs)
448 def on_train_batch_end(self, batch, logs=None): argument
453 logs: Dict. Aggregated metric results up until this batch.
456 self._call_batch_hook(ModeKeys.TRAIN, 'end', batch, logs=logs)
458 def on_test_batch_begin(self, batch, logs=None): argument
463 logs: Dict, contains the return value of `model.test_step`. Typically,
468 self._call_batch_hook(ModeKeys.TEST, 'begin', batch, logs=logs)
470 def on_test_batch_end(self, batch, logs=None): argument
475 logs: Dict. Aggregated metric results up until this batch.
478 self._call_batch_hook(ModeKeys.TEST, 'end', batch, logs=logs)
480 def on_predict_batch_begin(self, batch, logs=None): argument
485 logs: Dict, contains the return value of `model.predict_step`,
490 self._call_batch_hook(ModeKeys.PREDICT, 'begin', batch, logs=logs)
492 def on_predict_batch_end(self, batch, logs=None): argument
497 logs: Dict. Aggregated metric results up until this batch.
500 self._call_batch_hook(ModeKeys.PREDICT, 'end', batch, logs=logs)
502 def on_train_begin(self, logs=None): argument
506 logs: Dict. Currently no data is passed to this argument for this method
509 logs = self._process_logs(logs)
511 callback.on_train_begin(logs)
513 def on_train_end(self, logs=None): argument
517 logs: Dict. Currently no data is passed to this argument for this method
520 logs = self._process_logs(logs)
522 callback.on_train_end(logs)
524 def on_test_begin(self, logs=None): argument
528 logs: Dict. Currently no data is passed to this argument for this method
531 logs = self._process_logs(logs)
533 callback.on_test_begin(logs)
535 def on_test_end(self, logs=None): argument
539 logs: Dict. Currently no data is passed to this argument for this method
542 logs = self._process_logs(logs)
544 callback.on_test_end(logs)
546 def on_predict_begin(self, logs=None): argument
550 logs: Dict. Currently no data is passed to this argument for this method
553 logs = self._process_logs(logs)
555 callback.on_predict_begin(logs)
557 def on_predict_end(self, logs=None): argument
561 logs: Dict. Currently no data is passed to this argument for this method
564 logs = self._process_logs(logs)
566 callback.on_predict_end(logs)
608 ... def on_train_end(self, logs=None):
647 The `logs` dictionary that callback methods
669 def on_batch_begin(self, batch, logs=None): argument
674 def on_batch_end(self, batch, logs=None): argument
678 def on_epoch_begin(self, epoch, logs=None): argument
686 logs: Dict. Currently no data is passed to this argument for this method
691 def on_epoch_end(self, epoch, logs=None): argument
699 logs: Dict, metric results for this training epoch, and for the
708 def on_train_batch_begin(self, batch, logs=None): argument
719 logs: Dict, contains the return value of `model.train_step`. Typically,
724 self.on_batch_begin(batch, logs=logs)
728 def on_train_batch_end(self, batch, logs=None): argument
739 logs: Dict. Aggregated metric results up until this batch.
742 self.on_batch_end(batch, logs=logs)
746 def on_test_batch_begin(self, batch, logs=None): argument
760 logs: Dict, contains the return value of `model.test_step`. Typically,
767 def on_test_batch_end(self, batch, logs=None): argument
781 logs: Dict. Aggregated metric results up until this batch.
786 def on_predict_batch_begin(self, batch, logs=None): argument
797 logs: Dict, contains the return value of `model.predict_step`,
804 def on_predict_batch_end(self, batch, logs=None): argument
815 logs: Dict. Aggregated metric results up until this batch.
819 def on_train_begin(self, logs=None): argument
825 logs: Dict. Currently no data is passed to this argument for this method
830 def on_train_end(self, logs=None): argument
836 logs: Dict. Currently the output of the last call to `on_epoch_end()`
842 def on_test_begin(self, logs=None): argument
848 logs: Dict. Currently no data is passed to this argument for this method
853 def on_test_end(self, logs=None): argument
859 logs: Dict. Currently the output of the last call to
865 def on_predict_begin(self, logs=None): argument
871 logs: Dict. Currently no data is passed to this argument for this method
876 def on_predict_end(self, logs=None): argument
882 logs: Dict. Currently no data is passed to this argument for this method
921 def on_epoch_begin(self, epoch, logs=None): argument
925 def on_batch_end(self, batch, logs=None): argument
926 logs = logs or {}
927 batch_size = logs.get('size', 0)
930 num_steps = logs.get('num_steps', 1)
933 for k, v in logs.items():
942 def on_epoch_end(self, epoch, logs=None): argument
943 if logs is not None:
948 logs[k] = self.totals[k]
950 logs[k] = self.totals[k] / self.seen
962 def on_batch_end(self, batch, logs=None): argument
963 logs = logs or {}
964 loss = logs.get('loss')
1032 def on_train_begin(self, logs=None): argument
1036 def on_test_begin(self, logs=None): argument
1041 def on_predict_begin(self, logs=None): argument
1045 def on_epoch_begin(self, epoch, logs=None): argument
1051 def on_train_batch_end(self, batch, logs=None): argument
1052 self._batch_update_progbar(batch, logs)
1054 def on_test_batch_end(self, batch, logs=None): argument
1056 self._batch_update_progbar(batch, logs)
1058 def on_predict_batch_end(self, batch, logs=None): argument
1062 def on_epoch_end(self, epoch, logs=None): argument
1063 self._finalize_progbar(logs, self._train_step)
1065 def on_test_end(self, logs=None): argument
1067 self._finalize_progbar(logs, self._test_step)
1069 def on_predict_end(self, logs=None): argument
1070 self._finalize_progbar(logs, self._predict_step)
1107 def _batch_update_progbar(self, batch, logs=None): argument
1109 logs = logs or {}
1115 logs = copy.copy(logs)
1116 batch_size = logs.pop('size', 0)
1117 num_steps = logs.pop('num_steps', 1)
1118 logs.pop('batch', None)
1124 logs = tf_utils.sync_to_numpy_or_python_type(logs)
1125 self.progbar.update(self.seen, list(logs.items()), finalize=False)
1127 def _finalize_progbar(self, logs, counter): argument
1128 logs = tf_utils.sync_to_numpy_or_python_type(logs or {})
1133 counter *= logs.get('size', 1)
1136 self.progbar.update(self.target, list(logs.items()), finalize=True)
1165 def on_train_begin(self, logs=None): argument
1168 def on_epoch_end(self, epoch, logs=None): argument
1169 logs = logs or {}
1171 for k, v in logs.items():
1230 `epoch` and keys in `logs` (passed in `on_epoch_end`). For example: if
1362 def on_train_begin(self, logs=None): argument
1381 def on_train_batch_end(self, batch, logs=None): argument
1383 self._save_model(epoch=self._current_epoch, logs=logs)
1385 def on_epoch_begin(self, epoch, logs=None): argument
1388 def on_epoch_end(self, epoch, logs=None): argument
1392 self._save_model(epoch=epoch, logs=logs)
1411 def _save_model(self, epoch, logs): argument
1416 logs: the `logs` dict passed in to `on_batch_end` or `on_epoch_end`.
1418 logs = logs or {}
1423 logs = tf_utils.sync_to_numpy_or_python_type(logs)
1425 filepath = self._get_file_path(epoch, logs)
1429 current = logs.get(self.monitor)
1472 def _get_file_path(self, epoch, logs): argument
1479 file_path = self.filepath.format(epoch=epoch + 1, **logs)
1623 ... def on_epoch_begin(self, epoch, logs=None):
1678 def on_train_begin(self, logs=None): argument
1695 def on_train_end(self, logs=None): argument
1705 def on_epoch_end(self, epoch, logs=None): argument
1721 The quantity to be monitored needs to be available in `logs` dict.
1805 def on_train_begin(self, logs=None): argument
1812 def on_epoch_end(self, epoch, logs=None): argument
1813 current = self.get_monitor_value(logs)
1837 def on_train_end(self, logs=None): argument
1841 def get_monitor_value(self, logs): argument
1842 logs = logs or {}
1843 monitor_value = logs.get(self.monitor)
1847 self.monitor, ','.join(list(logs.keys())))
1891 def on_epoch_end(self, epoch, logs=None): argument
1894 logs = logs or {}
1897 for k, v in logs.items():
1960 def on_epoch_begin(self, epoch, logs=None): argument
1978 def on_epoch_end(self, epoch, logs=None): argument
1979 logs = logs or {}
1980 logs['lr'] = backend.get_value(self.model.optimizer.lr)
2035 This callback logs events for TensorBoard, including:
2059 parsed by TensorBoard. e.g. log_dir = os.path.join(working_dir, 'logs')
2094 tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir="./logs")
2118 tb_callback = tf.keras.callbacks.TensorBoard('./logs', update_freq=1)
2138 tb_callback = tf.keras.callbacks.TensorBoard('./logs', update_freq=1)
2147 log_dir='./logs', profile_batch=5)
2152 log_dir='./logs', profile_batch=(10,20))
2160 log_dir='logs',
2397 def on_train_begin(self, logs=None): argument
2403 def on_train_end(self, logs=None): argument
2412 def on_test_begin(self, logs=None): argument
2415 def on_test_end(self, logs=None): argument
2418 for name, value in logs.items():
2429 def on_train_batch_begin(self, batch, logs=None): argument
2439 def on_train_batch_end(self, batch, logs=None): argument
2454 def on_epoch_begin(self, epoch, logs=None): argument
2460 def on_epoch_end(self, epoch, logs=None): argument
2462 self._log_epoch_metrics(epoch, logs)
2476 """Logs the trace graph to TensorBoard."""
2486 def _collect_learning_rate(self, logs): argument
2489 logs['learning_rate'] = lr_schedule(self.model.optimizer.iterations)
2490 return logs
2498 def _log_epoch_metrics(self, epoch, logs): argument
2503 logs: Dict. Keys are scalar summary names, values are scalars.
2505 if not logs:
2508 train_logs = {k: v for k, v in logs.items() if not k.startswith('val_')}
2509 val_logs = {k: v for k, v in logs.items() if k.startswith('val_')}
2526 """Logs the weights of the Model to TensorBoard."""
2538 """Logs a weight as a TensorBoard image."""
2684 def on_train_begin(self, logs=None): argument
2687 def on_epoch_end(self, epoch, logs=None): argument
2688 logs = logs or {}
2689 logs['lr'] = backend.get_value(self.model.optimizer.lr)
2690 current = logs.get(self.monitor)
2694 self.monitor, ','.join(list(logs.keys())))
2752 def on_train_begin(self, logs=None): argument
2762 def on_epoch_end(self, epoch, logs=None): argument
2763 logs = logs or {}
2775 self.keys = sorted(logs.keys())
2779 logs = dict((k, logs[k]) if k in logs else (k, 'NA') for k in self.keys)
2796 row_dict.update((key, handle_value(logs[key])) for key in self.keys)
2800 def on_train_end(self, logs=None): argument
2814 `epoch`, `logs`
2816 `batch`, `logs`
2818 `logs`
2833 on_batch_begin=lambda batch,logs: print(batch))
2840 on_epoch_end=lambda epoch, logs: json_log.write(
2841 json.dumps({'epoch': epoch, 'loss': logs['loss']}) + '\n'),
2842 on_train_end=lambda logs: json_log.close()
2848 on_train_end=lambda logs: [
2871 self.on_epoch_begin = lambda epoch, logs: None
2875 self.on_epoch_end = lambda epoch, logs: None
2879 self.on_batch_begin = lambda batch, logs: None
2883 self.on_batch_end = lambda batch, logs: None
2887 self.on_train_begin = lambda logs: None
2891 self.on_train_end = lambda logs: None