message: Capture distribution strategy in Keras model constructor instead of at compile-time. This allows calling 'predict' outside of the distribution strategy scope even without compilation, and it allows the compile call to also be out of the distribution strategy scope.
diff: @@ -148,6 +148,10 @@ class Model(network.Network):
  # predict on a model without compiling it.
  self._distribution_strategy = None
  self._compile_time_distribution_strategy = None
  + if (ops.executing_eagerly_outside_functions() and
  + distribution_strategy_context.has_strategy()):
  + self._set_strategy(
  + distribution_strategy_context.get_strategy())
  # This flag is used to track if the user is using the deprecated path of
  # passing distribution strategy to compile rather than creating the model
  @@ -158,6 +162,10 @@ class Model(network.Network):
  self._experimental_run_tf_function = (
  ops.executing_eagerly_outside_functions())
  + @trackable.no_automatic_dependency_tracking
  + def _set_strategy(self, strategy):
  + self._compile_time_distribution_strategy = strategy
  +
  def get_weights(self):
  """Retrieves the weights of the model.
  @@ -327,9 +335,6 @@ class Model(network.Network):
  # Fallback out of things that aren't supported with v2 loops
  self._experimental_run_tf_function = False
  - self._compile_time_distribution_strategy = (
  - distribution_strategy_context.get_strategy())
  -
  if distribute is not None:
  if tf2.enabled() or self._experimental_run_tf_function:
  raise ValueError(
  