aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/boosted_trees
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com>2018-07-14 23:30:41 +0000
committerGravatar Yong Tang <yong.tang.github@outlook.com>2018-07-14 23:30:41 +0000
commit43d622778f2cc9d089e864d6feca9125d2803783 (patch)
treed54815bf1c1e5dd66b5beda145d8571f97c49d07 /tensorflow/contrib/boosted_trees
parenta398d1c1a47ad58ab642dc70d1d281f5b77b07de (diff)
Fix bug in custom_export_strategy.py for python 3
by add compat.as_bytes Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'tensorflow/contrib/boosted_trees')
-rw-r--r--tensorflow/contrib/boosted_trees/estimator_batch/custom_export_strategy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tensorflow/contrib/boosted_trees/estimator_batch/custom_export_strategy.py b/tensorflow/contrib/boosted_trees/estimator_batch/custom_export_strategy.py
index 62f1f4122b..0cbd8f6501 100644
--- a/tensorflow/contrib/boosted_trees/estimator_batch/custom_export_strategy.py
+++ b/tensorflow/contrib/boosted_trees/estimator_batch/custom_export_strategy.py
@@ -32,6 +32,7 @@ from tensorflow.python.framework import ops
from tensorflow.python.platform import gfile
from tensorflow.python.saved_model import loader as saved_model_loader
from tensorflow.python.saved_model import tag_constants
+from tensorflow.python.util import compat
_SPARSE_FLOAT_FEATURE_NAME_TEMPLATE = "%s_%d"
@@ -88,9 +89,9 @@ def make_custom_export_strategy(name,
len(sparse_float_indices), len(sparse_int_indices))
sorted_by_importance = sorted(
feature_importances.items(), key=lambda x: -x[1])
- assets_dir = os.path.join(result_dir, "assets.extra")
+ assets_dir = os.path.join(compat.as_bytes(result_dir), compat.as_bytes("assets.extra"))
gfile.MakeDirs(assets_dir)
- with gfile.GFile(os.path.join(assets_dir, "feature_importances"),
+ with gfile.GFile(os.path.join(compat.as_bytes(assets_dir), compat.as_bytes("feature_importances")),
"w") as f:
f.write("\n".join("%s, %f" % (k, v) for k, v in sorted_by_importance))
return result_dir