Skip to content

Commit

Permalink
Fix issue tensorflow#21,support both python 2.7 and python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
seetea committed Mar 26, 2016
1 parent b0c6793 commit 1297505
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
loading and execution code.
"""

from __future__ import print_function

# This is a placeholder for a Google-internal import.

import tensorflow as tf
Expand Down Expand Up @@ -63,7 +65,7 @@ def Export():
# CopyAssets is used as a callback during export to copy files to the
# given export directory.
def CopyAssets(export_path):
print "copying asset files to: %s" % export_path
print("copying asset files to: %s" % export_path)

# Use a fixed global step number.
global_step_tensor = tf.Variable(123, name="global_step")
Expand Down
5 changes: 3 additions & 2 deletions tensorflow_serving/session_bundle/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import os
import re
import six

import tensorflow as tf

Expand Down Expand Up @@ -94,7 +95,7 @@ def generic_signature(name_tensor_map):
A Signature message.
"""
signature = manifest_pb2.Signature()
for name, tensor in name_tensor_map.iteritems():
for name, tensor in six.iteritems(name_tensor_map):
signature.generic_signature.map[name].tensor_name = tensor.name
return signature

Expand Down Expand Up @@ -167,7 +168,7 @@ def init(self,
signatures_proto = manifest_pb2.Signatures()
if default_graph_signature:
signatures_proto.default_signature.CopyFrom(default_graph_signature)
for signature_name, signature in named_graph_signatures.iteritems():
for signature_name, signature in six.iteritems(named_graph_signatures):
signatures_proto.named_signatures[signature_name].CopyFrom(signature)
signatures_any_buf = any_pb2.Any()
signatures_any_buf.Pack(signatures_proto)
Expand Down

0 comments on commit 1297505

Please sign in to comment.