message: Use _get_distribution_strategy only when it is available.
diff: @@ -1526,10 +1526,14 @@ class TensorBoard(Callback):
  """Sets Keras model and writes graph if specified."""
  self.model = model
  + # In case this callback is used via native Keras, _get_distribution_strategy does not exist.
  + if hasattr(self.model, '_get_distribution_strategy'):
  # TensorBoard callback involves writing a summary file in a
  # possibly distributed settings.
  self._log_write_dir = distributed_file_utils.write_dirpath(
  self.log_dir, self.model._get_distribution_strategy()) # pylint: disable=protected-access
  + else:
  + self._log_write_dir = self.log_dir
  with context.eager_mode():
  self._close_writers()
  @@ -1725,6 +1729,8 @@ class TensorBoard(Callback):
  summary_state.writer = self._prev_summary_writer
  summary_state.step = self._prev_summary_step
  + # In case this callback is used via native Keras, _get_distribution_strategy does not exist.
  + if hasattr(self.model, '_get_distribution_strategy'):
  # Safely remove the unneeded temp files.
  distributed_file_utils.remove_temp_dirpath(
  self.log_dir, self.model._get_distribution_strategy()) # pylint: disable=protected-access
  