Fix writing binary summaries in python3.
In python 3, tf.string tensors are bytes() objects when fetched, not str(). six.binary_type maps exactly to tf.string in python 2 and 3, so use it to determine if we should try to interpret a metric as a tf.Summary proto.
This commit is contained in:
parent
92d622d27f
commit
0b012956d2
@ -1103,7 +1103,7 @@ def _write_dict_to_summary(output_dir,
|
||||
isinstance(dictionary[key], np.int32) or
|
||||
isinstance(dictionary[key], int)):
|
||||
summary_proto.value.add(tag=key, simple_value=int(dictionary[key]))
|
||||
elif isinstance(dictionary[key], six.string_types):
|
||||
elif isinstance(dictionary[key], six.binary_type):
|
||||
try:
|
||||
summ = summary_pb2.Summary.FromString(dictionary[key])
|
||||
for i, _ in enumerate(summ.value):
|
||||
|
Loading…
x
Reference in New Issue
Block a user