aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/metrics/python/metrics/classification.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/metrics/python/metrics/classification.py')
-rw-r--r--tensorflow/contrib/metrics/python/metrics/classification.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tensorflow/contrib/metrics/python/metrics/classification.py b/tensorflow/contrib/metrics/python/metrics/classification.py
index 9c58d0c619..26aba1cc51 100644
--- a/tensorflow/contrib/metrics/python/metrics/classification.py
+++ b/tensorflow/contrib/metrics/python/metrics/classification.py
@@ -26,7 +26,7 @@ from tensorflow.python.ops import math_ops
# TODO(nsilberman): move into metrics/python/ops/
-def accuracy(predictions, labels, weights=None):
+def accuracy(predictions, labels, weights=None, name=None):
"""Computes the percentage of times that predictions matches labels.
Args:
@@ -35,6 +35,7 @@ def accuracy(predictions, labels, weights=None):
labels: the ground truth values, a `Tensor` of any shape and
bool, integer, or string dtype.
weights: None or `Tensor` of float values to reweight the accuracy.
+ name: A name for the operation (optional).
Returns:
Accuracy `Tensor`.
@@ -52,7 +53,7 @@ def accuracy(predictions, labels, weights=None):
raise ValueError('Dtypes of predictions and labels should match. '
'Given: predictions (%r) and labels (%r)' %
(predictions.dtype, labels.dtype))
- with ops.name_scope('accuracy', values=[predictions, labels]):
+ with ops.name_scope(name, 'accuracy', values=[predictions, labels]):
is_correct = math_ops.cast(
math_ops.equal(predictions, labels), dtypes.float32)
if weights is not None: