【发布时间】:2019-10-16 23:57:28
【问题描述】:
在the tutorial之后,我得到了Tensorflow的直方图,
import tensorflow as tf
k = tf.placeholder(tf.float32)
# Make a normal distribution, with a shifting mean
mean_moving_normal = tf.random_normal(shape=[1000], mean=(5*k), stddev=1)
# Record that distribution into a histogram summary
tf.summary.histogram("normal/moving_mean", mean_moving_normal)
# Setup a session and summary writer
sess = tf.Session()
writer = tf.summary.FileWriter("/tmp/histogram_example")
summaries = tf.summary.merge_all()
# Setup a loop and write the summaries to disk
N = 400
for step in range(N):
k_val = step/float(N)
summ = sess.run(summaries, feed_dict={k: k_val})
writer.add_summary(summ, global_step=step)
下一步,我想使用Tensorboard的API提取直方图数据,我的代码在这里
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
event_acc = EventAccumulator(summary_path)
event_acc.Reload()
# Show all tags in the log file
tags = event_acc.Tags()
hist_dict = {}
for hist_event in event_acc.Histograms('normal/moving_mean'):
hist_dict.update({hist_event.step: (hist_event.histogram_value.bucket_limit,
hist_event.histogram_value.bucket)})
但是,它只返回了最后一个输出。如何获取所有数据?
【问题讨论】:
标签: tensorflow tensorflow-serving