aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/estimator
diff options
context:
space:
mode:
authorGravatar Goutham Bhat <goutham@google.com>2018-09-18 16:44:59 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-18 16:49:23 -0700
commitb9e6bbc95bcffa481d29e31b448a03a91ba17eac (patch)
tree7f638e375d86e0bf4f36fcb5c8e2917a317a306c /tensorflow/contrib/estimator
parent86b8f034e4d3d3d12d1e9d1b94170b271491bed3 (diff)
Return OrderedDict as eval results should be sorted by global_step key.
PiperOrigin-RevId: 213541935
Diffstat (limited to 'tensorflow/contrib/estimator')
-rw-r--r--tensorflow/contrib/estimator/python/estimator/early_stopping.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tensorflow/contrib/estimator/python/estimator/early_stopping.py b/tensorflow/contrib/estimator/python/estimator/early_stopping.py
index 3eab21d5ac..e6e25e319f 100644
--- a/tensorflow/contrib/estimator/python/estimator/early_stopping.py
+++ b/tensorflow/contrib/estimator/python/estimator/early_stopping.py
@@ -18,6 +18,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
+import collections
import operator
import os
@@ -306,7 +307,8 @@ def read_eval_metrics(eval_dir):
metrics[value.tag] = value.simple_value
if metrics:
eval_metrics_dict[event.step] = metrics
- return eval_metrics_dict
+ return collections.OrderedDict(
+ sorted(eval_metrics_dict.items(), key=lambda t: t[0]))
def _stop_if_threshold_crossed_hook(estimator, metric_name, threshold,