Skip to content

Commit 6eba8a3

Browse files
committed
Merge pull request #26 from seetea/fix-issue-21
Fix issue #21,support both python 2.7 and python 3.4
2 parents b0c6793 + 1297505 commit 6eba8a3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tensorflow_serving/session_bundle/example/export_half_plus_two.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
loading and execution code.
2727
"""
2828

29+
from __future__ import print_function
30+
2931
# This is a placeholder for a Google-internal import.
3032

3133
import tensorflow as tf
@@ -63,7 +65,7 @@ def Export():
6365
# CopyAssets is used as a callback during export to copy files to the
6466
# given export directory.
6567
def CopyAssets(export_path):
66-
print "copying asset files to: %s" % export_path
68+
print("copying asset files to: %s" % export_path)
6769

6870
# Use a fixed global step number.
6971
global_step_tensor = tf.Variable(123, name="global_step")

tensorflow_serving/session_bundle/exporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import os
2222
import re
23+
import six
2324

2425
import tensorflow as tf
2526

@@ -94,7 +95,7 @@ def generic_signature(name_tensor_map):
9495
A Signature message.
9596
"""
9697
signature = manifest_pb2.Signature()
97-
for name, tensor in name_tensor_map.iteritems():
98+
for name, tensor in six.iteritems(name_tensor_map):
9899
signature.generic_signature.map[name].tensor_name = tensor.name
99100
return signature
100101

@@ -167,7 +168,7 @@ def init(self,
167168
signatures_proto = manifest_pb2.Signatures()
168169
if default_graph_signature:
169170
signatures_proto.default_signature.CopyFrom(default_graph_signature)
170-
for signature_name, signature in named_graph_signatures.iteritems():
171+
for signature_name, signature in six.iteritems(named_graph_signatures):
171172
signatures_proto.named_signatures[signature_name].CopyFrom(signature)
172173
signatures_any_buf = any_pb2.Any()
173174
signatures_any_buf.Pack(signatures_proto)

0 commit comments

Comments
 (0)