Skip to content

Commit

Permalink
Compute metrics under distributed strategies. (tensorflow#4942)
Browse files Browse the repository at this point in the history
Removed the conditional over distributed strategies when computing metrics.
Metrics are now computed even when distributed strategies are used.
  • Loading branch information
tejaswid authored and Taylor Robie committed Jul 30, 2018
1 parent 887bbcb commit a88b89b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions official/resnet/resnet_run_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,7 @@ def exclude_batch_norm(name):
else:
train_op = None

if not tf.contrib.distribute.has_distribution_strategy():
accuracy = tf.metrics.accuracy(labels, predictions['classes'])
else:
# Metrics are currently not compatible with distribution strategies during
# training. This does not affect the overall performance of the model.
accuracy = (tf.no_op(), tf.constant(0))
accuracy = tf.metrics.accuracy(labels, predictions['classes'])

metrics = {'accuracy': accuracy}

Expand Down

0 comments on commit a88b89b

Please sign in to comment.