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

Method _log_weights

tensorflow/python/keras/callbacks.py:1750–1764  ·  view source on GitHub ↗

Logs the weights of the Model to TensorBoard.

(self, epoch)

Source from the content-addressed store, hash-verified

1748 summary_ops_v2.scalar(name, value, step=step)
1749
1750 def _log_weights(self, epoch):
1751 """Logs the weights of the Model to TensorBoard."""
1752 writer = self._get_writer(self._train_run_name)
1753 with context.eager_mode(), \
1754 writer.as_default(), \
1755 summary_ops_v2.always_record_summaries():
1756 for layer in self.model.layers:
1757 for weight in layer.weights:
1758 weight_name = weight.name.replace(':', '_')
1759 with ops.init_scope():
1760 weight = K.get_value(weight)
1761 summary_ops_v2.histogram(weight_name, weight, step=epoch)
1762 if self.write_images:
1763 self._log_weight_as_image(weight, weight_name, epoch)
1764 writer.flush()
1765
1766 def _log_weight_as_image(self, weight, weight_name, epoch):
1767 """Logs a weight as a TensorBoard image."""

Callers 1

on_epoch_endMethod · 0.95

Calls 7

_get_writerMethod · 0.95
_log_weight_as_imageMethod · 0.95
replaceMethod · 0.80
histogramMethod · 0.80
as_defaultMethod · 0.45
get_valueMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected