if six.PY3:
if isinstance(text, str):
return text
elif isinstance(text, bytes):
return text.decode("utf-8", "ignore")
else:
raise ValueError("Unsupported string type: %s" % (type(text)))
After Change
def convert_to_unicode(text):
Returns the given argument as a unicode string.
return tf.compat.as_text(text)
def printable_text(text):
Returns text encoded in a way suitable for print or `tf.logging`.
return tf.compat.as_str_any(text)