您可以summary_str
通过将其解析为tf.Summary
协议缓冲区来获得文本表示,如下所示:
summary_proto = tf.Summary()
summary_proto.ParseFromString(summary_str)
print(summary_proto)
然后,您可以将其转换为字典映射字符串标记到浮点数:
summaries = {}
for val in summary_proto.value:
# Assuming all summaries are scalars.
summaries[val.tag] = val.simple_value