1、add saclar and histogram

tf.summary.scalar('mean', mean)
tf.summary.histogram('histogram', var)

2、 sess-op

merged = tf.summary.merge_all()

3、writer init

train_writer = tf.summary.FileWriter(FLAGS.summaries_dir + '/train',
sess.graph)

4、sess run & write to file

summary, acc = sess.run([merged, accuracy], feed_dict=feed_dict(False))
test_writer.add_summary(summary, i)

举例:

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 --logdir=/tmp/histogram_example

https://tensorflow.google.cn/guide/tensorboard_histograms

https://tensorflow.google.cn/guide/summaries_and_tensorboard

最新文章

  1. iOS10之Expected App Behaviors
  2. SWT布局管理器
  3. git rm –cached filename
  4. libsqlite3.dylib找不到
  5. Linux 在一个命令行上执行多个命令
  6. 苹果iOS锁屏制作
  7. 实现Android半透明Menu效果的开发实例
  8. 搭建LNMP架构
  9. C#最基本的小说爬虫
  10. plsql 永久注册码适用个版本
  11. CF715B. Complete The Graph
  12. 实验一 C运行环境与最简单程序设计
  13. jenkins+git+maven
  14. 多任务fork、multiprocessing、进程池、进程间通信-Queue
  15. Zabbix告警脚本-微信
  16. 基于CentOS 7 搭建 GitLab
  17. vue中全选和取消
  18. Android 5.0 Phone初始化分析
  19. swift简单处理调用高清大图导致内存暴涨的情况
  20. 【HAOI2011】problem a

热门文章

  1. 转://IO的基础概念
  2. 使用 docker-compose 快速安装Jenkins
  3. 零基础如何自学java开发?
  4. Hadoop系列005-Hadoop运行模式(下)
  5. [Abp vNext 源码分析] - 3. 依赖注入与拦截器
  6. C#多线程之旅~上车吧?
  7. ArticleRemoveDelDialog【基于AlertDialog的回收删除对话框】
  8. Java——泛型
  9. C# 委托基础1.0
  10. MySQL 笔记整理(10) --MySQL为什么有时会选错索引?