def set_model(self, model):
        """Sets Keras model and writes graph if specified."""
        self._model = model
        self._log_write_dir = self.log_dir

        self._train_dir = os.path.join(self._log_write_dir, "train")
        self._val_dir = os.path.join(self._log_write_dir, "validation")
        self._writers = {}  # Resets writers.

        self._should_write_train_graph = False
        if self.write_graph:
            self._write_keras_model_summary()
            self._should_write_train_graph = True
        if self.embeddings_freq:
            self._configure_embeddings()
Sets Keras model and writes graph if specified.
keras/src/callbacks/tensorboard.py