Sets Keras model and writes graph if specified.
(self, model)
| 1493 | 'Callback: ' + str(unrecognized_kwargs)) |
| 1494 | |
| 1495 | def set_model(self, model): |
| 1496 | """Sets Keras model and writes graph if specified.""" |
| 1497 | self.model = model |
| 1498 | with context.eager_mode(): |
| 1499 | self._close_writers() |
| 1500 | if self.write_graph: |
| 1501 | with self._get_writer(self._train_run_name).as_default(): |
| 1502 | with summary_ops_v2.always_record_summaries(): |
| 1503 | if not model.run_eagerly: |
| 1504 | summary_ops_v2.graph(K.get_graph(), step=0) |
| 1505 | |
| 1506 | summary_writable = ( |
| 1507 | self.model._is_graph_network or # pylint: disable=protected-access |
| 1508 | self.model.__class__.__name__ == 'Sequential') # pylint: disable=protected-access |
| 1509 | if summary_writable: |
| 1510 | summary_ops_v2.keras_model('keras', self.model, step=0) |
| 1511 | |
| 1512 | if self.embeddings_freq: |
| 1513 | self._configure_embeddings() |
| 1514 | |
| 1515 | self._prev_summary_writer = context.context().summary_writer |
| 1516 | self._prev_summary_recording = context.context().summary_recording |
| 1517 | self._prev_summary_step = context.context().summary_step |
| 1518 | |
| 1519 | def _configure_embeddings(self): |
| 1520 | """Configure the Projector for embeddings.""" |
nothing calls this directly
no test coverage detected