diff options
author | 2017-06-09 15:19:47 -0700 | |
---|---|---|
committer | 2017-06-09 15:26:01 -0700 | |
commit | c9275fe61d9c9f3c6960ed54175a488ea09f3b04 (patch) | |
tree | aab26e8acb51ede5b04eeb11586aa4c61b0f5d22 | |
parent | 386ed6fd1848eea63a2cfa636e871350d5b91d2e (diff) |
Better error message when a MetricSpec overspecifies keys.
PiperOrigin-RevId: 158569852
-rw-r--r-- | tensorflow/contrib/learn/python/learn/metric_spec.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/contrib/learn/python/learn/metric_spec.py b/tensorflow/contrib/learn/python/learn/metric_spec.py index eafc925ad6..2f2c931786 100644 --- a/tensorflow/contrib/learn/python/learn/metric_spec.py +++ b/tensorflow/contrib/learn/python/learn/metric_spec.py @@ -401,7 +401,9 @@ class MetricSpec(object): if not isinstance(dict_or_tensor, dict): raise ValueError('MetricSpec with ' + name + '_key specified' ' requires ' + - name + 's dict, got %s' % dict_or_tensor) + name + 's dict, got %s.\n' % dict_or_tensor + + 'You must not provide a %s_key if you ' % name + + 'only have a single Tensor as %ss.' % name) if key not in dict_or_tensor: raise KeyError( 'Key \'%s\' missing from %s.' % (key, dict_or_tensor.keys())) |