Skip to content

Commit

Permalink
Better error message when a MetricSpec overspecifies keys.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 158569852
  • Loading branch information
martinwicke authored and tensorflower-gardener committed Jun 9, 2017
1 parent 386ed6f commit c9275fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tensorflow/contrib/learn/python/learn/metric_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ def _get_dict(name, dict_or_tensor, key):
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()))
Expand Down

0 comments on commit c9275fe

Please sign in to comment.