message: Cleanup training_distributed unnecessary scopes since we're already in the strategy scope in the entire function
diff: @@ -314,7 +314,6 @@ def experimental_tpu_fit_loop(model,
  dtype='int32',
  name='steps_per_run')
  - with current_strategy.scope():
  ctx = current_strategy.extended.experimental_run_steps_on_iterator(
  step_fn, iterator, iterations=steps_per_run,
  initial_loop_values=initial_loop_values)
  @@ -325,7 +324,6 @@ def experimental_tpu_fit_loop(model,
  do_validation = bool(validation_steps)
  if model._compile_distribution:
  - with current_strategy.scope():
  distributed_training_utils._copy_weights_to_distributed_model(
  model, model._distributed_model_train)
  @@ -346,7 +344,6 @@ def experimental_tpu_fit_loop(model,
  callbacks.on_train_begin()
  for epoch in range(initial_epoch, epochs):
  - with current_strategy.scope():
  distributed_training_utils._reset_metrics(
  model, model._distributed_model_train)
  callbacks.on_epoch_begin(epoch)
  @@ -382,7 +379,6 @@ def experimental_tpu_fit_loop(model,
  if model._compile_distribution:
  # Since we create a new clone from the original model we need to copy
  # the weights back to the original model before we can run validation.
  - with current_strategy.scope():
  distributed_training_utils._copy_weights_to_original_model(
  model, model._distributed_model_train, ModeKeys.TRAIN)
  @@ -404,7 +400,6 @@ def experimental_tpu_fit_loop(model,
  if model._compile_distribution:
  # Copy the weights back from the replicated model to the original model.
  - with current_strategy.scope():
  distributed_training_utils._copy_weights_to_original_model(
  model, model._distributed_model_train, ModeKeys.TRAIN)
  scope.__exit__(None, None, None)
  @@ -491,7 +486,6 @@ def experimental_tpu_test_loop(model,
  tensor = model._all_stateful_metrics_tensors[name]
  initial_loop_values[name] = array_ops.zeros(tensor.shape, tensor.dtype)
  - with current_strategy.scope():
  # TODO(priyag): Use steps_per_run when we use new metrics as they will
  # allow handling metric computation at each step using variables.
  ctx = current_strategy.extended.experimental_run_steps_on_iterator(
  @@ -505,10 +499,9 @@ def experimental_tpu_test_loop(model,
  progbar = Progbar(target=steps)
  if model._compile_distribution:
  - with current_strategy.scope():
  distributed_training_utils._copy_weights_to_distributed_model(
  model, model._distributed_model_test)
  - with current_strategy.scope():
  +
  distributed_training_utils._reset_metrics(
  model, model._distributed_model_test)
  @@ -609,7 +602,6 @@ def experimental_tpu_predict_loop(model, dataset, verbose=0, steps=None):
  shape.dims = [batch_dimension] + shape.dims[1:]
  initial_loop_values[name] = array_ops.zeros(shape, tensor.dtype)
  - with current_strategy.scope():
  # TODO(priyag, sourabhbajaj): Support steps_per_run if/when we add outfeed.
  ctx = current_strategy.extended.experimental_run_steps_on_iterator(
  step_fn, iterator, iterations=1,
  @@ -622,10 +614,9 @@ def experimental_tpu_predict_loop(model, dataset, verbose=0, steps=None):
  progbar = Progbar(target=steps)
  if model._compile_distribution:
  - with current_strategy.scope():
  distributed_training_utils._copy_weights_to_distributed_model(
  model, model._distributed_model_predict)
  - with current_strategy.scope():
  +
  distributed_training_utils._reset_metrics(
  model, model._distributed_model_predict)
  