Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions model_training_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def train_steps(iterator, steps):
'retracing.')

for _ in tf.range(steps):
strategy.experimental_run_v2(_replicated_step, args=(next(iterator),))
strategy.run(_replicated_step, args=(next(iterator),))

def train_single_step(iterator):
"""Performs a distributed training step.
Expand All @@ -247,7 +247,7 @@ def train_single_step(iterator):
Raises:
ValueError: Any of the arguments or tensor shapes are invalid.
"""
strategy.experimental_run_v2(_replicated_step, args=(next(iterator),))
strategy.run(_replicated_step, args=(next(iterator),))

def test_step(iterator):
"""Calculates evaluation metrics on distributed devices."""
Expand All @@ -260,7 +260,7 @@ def _test_step_fn(inputs):
for metric in eval_metrics:
metric.update_state(labels, model_outputs)

strategy.experimental_run_v2(_test_step_fn, args=(next(iterator),))
strategy.run(_replicated_step, args=(next(iterator),))

if not run_eagerly:
train_single_step = tf.function(train_single_step)
Expand Down