aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/metrics_impl.py
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-02-01 18:13:33 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-02-01 18:33:19 -0800
commitd1ba01f81d8fa1d0171ba9ce871599063d5c7eb9 (patch)
treecd28fd2d32712c59f8452ede903cd592e0dc95bd /tensorflow/python/ops/metrics_impl.py
parentffc667757c6c328e48d80c14f97e32cf6a9d0f53 (diff)
Merge changes from github.
Change: 146316196
Diffstat (limited to 'tensorflow/python/ops/metrics_impl.py')
-rw-r--r--tensorflow/python/ops/metrics_impl.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tensorflow/python/ops/metrics_impl.py b/tensorflow/python/ops/metrics_impl.py
index 33ce2b8b92..55aa425524 100644
--- a/tensorflow/python/ops/metrics_impl.py
+++ b/tensorflow/python/ops/metrics_impl.py
@@ -271,7 +271,8 @@ def mean(values, weights=None, metrics_collections=None,
num_values = math_ops.reduce_sum(weights)
update_total_op = state_ops.assign_add(total, math_ops.reduce_sum(values))
- update_count_op = state_ops.assign_add(count, num_values)
+ with ops.control_dependencies([values]):
+ update_count_op = state_ops.assign_add(count, num_values)
mean_t = _safe_div(total, count, 'value')
update_op = _safe_div(update_total_op, update_count_op, 'update_op')
@@ -983,7 +984,8 @@ def mean_tensor(values, weights=None, metrics_collections=None,
num_values = math_ops.multiply(num_values, weights)
update_total_op = state_ops.assign_add(total, values)
- update_count_op = state_ops.assign_add(count, num_values)
+ with ops.control_dependencies([values]):
+ update_count_op = state_ops.assign_add(count, num_values)
def compute_mean(total, count, name):
non_zero_count = math_ops.maximum(count,