Logs the weights of the Model to TensorBoard.
(self, epoch)
| 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.""" |
no test coverage detected