Use the default strategy if no strategy is specified in v2 inside the new V2 codepath.

PiperOrigin-RevId: 258183084
This commit is contained in:
Scott Zhu 2019-07-15 09:53:46 -07:00 committed by TensorFlower Gardener
parent 8df7ce02ba
commit d6b43ac543

View File

@ -371,8 +371,8 @@ class Loop(training_utils.TrainingLoop):
def _get_distribution_strategy(model):
if model._distribution_strategy:
return model._distribution_strategy
# TODO(scottzhu): might want to just get the default strategy in future.
elif distribution_strategy_context.has_strategy():
elif not distribution_strategy_context.has_strategy():
# Use the default strategy if no strategy is specified.
return distribution_strategy_context.get_strategy()
else:
return None