MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / on_batch_end

Method on_batch_end

tensorflow/python/keras/callbacks_v1.py:345–367  ·  view source on GitHub ↗

Writes scalar summaries for metrics on every training batch. Performs profiling if current batch is in profiler_batches.

(self, batch, logs=None)

Source from the content-addressed store, hash-verified

343 self.writer.flush()
344
345 def on_batch_end(self, batch, logs=None):
346 """Writes scalar summaries for metrics on every training batch.
347
348 Performs profiling if current batch is in profiler_batches.
349 """
350 # Don't output batch_size and batch number as TensorBoard summaries
351 logs = logs or {}
352 self._samples_seen += logs.get('size', 1)
353 samples_seen_since = self._samples_seen - self._samples_seen_at_last_write
354 if self.update_freq != 'epoch' and samples_seen_since >= self.update_freq:
355 batch_logs = {('batch_' + k): v
356 for k, v in logs.items()
357 if k not in ['batch', 'size', 'num_steps']}
358 self._write_custom_summaries(self._total_batches_seen, batch_logs)
359 self._samples_seen_at_last_write = self._samples_seen
360 self._total_batches_seen += 1
361 if self._is_profiling:
362 profiler.save(self.log_dir, profiler.stop())
363 self._is_profiling = False
364 elif (not self._is_profiling and
365 self._total_batches_seen == self._profile_batch - 1):
366 profiler.start()
367 self._is_profiling = True
368
369 def on_train_begin(self, logs=None):
370 if self._profile_batch == 1:

Calls 5

getMethod · 0.45
saveMethod · 0.45
stopMethod · 0.45
startMethod · 0.45