Python 如何从tensorflow 2摘要编写器读取数据

Python 如何从tensorflow 2摘要编写器读取数据,python,tensorflow,tensorflow2.0,tensorboard,Python,Tensorflow,Tensorflow2.0,Tensorboard,我在从tensorflow摘要编写器读取数据时遇到问题 我正在使用tensorflow网站上示例中的作者: 收益率: 'distributions': [], 'graph': False, 'histograms': [], 'images': [], 'meta_graph': False, 'run_metadata': [], 'scalars': [], 'tensors': ['my_metric']}``` 如果我试图获取张量数据: import pandas

我在从tensorflow摘要编写器读取数据时遇到问题

我正在使用tensorflow网站上示例中的作者:

收益率:

 'distributions': [],
 'graph': False,
 'histograms': [],
 'images': [],
 'meta_graph': False,
 'run_metadata': [],
 'scalars': [],
 'tensors': ['my_metric']}```

如果我试图获取张量数据:

import pandas as pd
pd.DataFrame(event_acc.Tensors('my_metric'))
我没有得到正确的值:

wall_time   step    tensor_proto
0   1.590743e+09    3   dtype: DT_FLOAT\ntensor_shape {\n}\ntensor_con...
1   1.590743e+09    20  dtype: DT_FLOAT\ntensor_shape {\n}\ntensor_con...
2   1.590743e+09    24  dtype: DT_FLOAT\ntensor_shape {\n}\ntensor_con...
3   1.590743e+09    32  dtype: DT_FLOAT\ntensor_shape {\n}\ntensor_con...
...
如何获取实际的摘要数据(对于100个步骤中的每一步,该数据应为0.5)


下面是一个colab笔记本,上面有代码:

您需要将事件累加器中存储为消息的张量值转换为数组,您可以使用以下方法:

pd.DataFrame([(w,s,tf.make_ndarray(t)),用于事件_acc.张量('my_metric')中的w,s,t],
列=['wall_time','step','tensor'])

为了避免步骤的子集,我建议:

event_acc = EventAccumulator("/tmp/mylogs/eager", size_guidance={'tensors': 0})

太棒了,谢谢。是否有理由只提供步骤(3、20、24)的子集?
event_acc = EventAccumulator("/tmp/mylogs/eager", size_guidance={'tensors': 0})