定义summary

writer = tf.summary.FileWriter(logdir=self.han_config.log_path, graph=session.graph)

1.scalar存储结果

  a.先在训练的循环外定义:

test_accuracy_summary = tf.summary.scalar('test_accuracy', self.han_model.accuracy)
test_loss_summary = tf.summary.scalar('test_loss', self.han_model.loss)
test_scalar = tf.summary.merge([test_accuracy_summary, test_loss_summary])

  b.在session run的时候run test_scalar,获得值,然后再添加。

 writer.add_summary(summary=train_scalar_, global_step=steps)

2.histogram存储权重,偏执。

  a.先在训练的循环外定义:

            W_w_attention_word_histogram = tf.summary.histogram('W_w_attention_word', self.han_model.W_w_attention_word)
W_b_attention_word_histogram = tf.summary.histogram('W_w_attention_word', self.han_model.W_b_attention_word)
context_vecotor_word_histogram = tf.summary.histogram('context_vecotor_word',
self.han_model.context_vecotor_word)
W_w_attention_sentence_histogram = tf.summary.histogram('W_w_attention_sentence',
self.han_model.W_w_attention_sentence)
W_b_attention_sentence_histogram = tf.summary.histogram('W_b_attention_sentence',
self.han_model.W_b_attention_sentence)
context_vecotor_sentence_histogram = tf.summary.histogram('context_vecotor_sentence',
self.han_model.context_vecotor_sentence)
train_variable_histogram = tf.summary.merge([W_w_attention_word_histogram, W_b_attention_word_histogram,
context_vecotor_word_histogram, W_w_attention_sentence_histogram,
W_b_attention_sentence_histogram, context_vecotor_sentence_histogram])

  b.在session run的时候run test_scalar,获得值,然后再添加。

writer.add_summary(summary=train_variable_histogram_, global_step=steps)

tensorflow summary的更多相关文章

  1. Tensorflow Summary用法

    本文转载自:https://www.cnblogs.com/lyc-seu/p/8647792.html Tensorflow Summary用法 tensorboard 作为一款可视化神器,是学习t ...

  2. tensorflow API _ 5 (tensorflow.summary)

    tensorflow的可视化是使用summary和tensorboard合作完成的. 基本用法 首先明确一点,summary也是op. 输出网络结构 with tf.Session() as sess ...

  3. tensorflow summary demo with linear-model

    tf.summary + tensorboard 用来把graph图中的相关信息,如结构图.学习率.准确率.Loss等数据,写入到本地硬盘,并通过浏览器可视化之. 整理的代码如下: import te ...

  4. 通俗易懂之Tensorflow summary类 & 初识tensorboard

    前面学习的cifar10项目虽小,但却五脏俱全.全面理解该项目非常有利于进一步的学习和提高,也是走向更大型项目的必由之路.因此,summary依然要从cifar10项目说起,通俗易懂的理解并运用sum ...

  5. Tensorflow学习笔记——Summary用法

    tensorboard 作为一款可视化神器,可以说是学习tensorflow时模型训练以及参数可视化的法宝. 而在训练过程中,主要用到了tf.summary()的各类方法,能够保存训练过程以及参数分布 ...

  6. TensorFlow —— Demo

    import tensorflow as tf g = tf.Graph() # 创建一个Graph对象 在模型中有两个"全局"风格的Variable对象:global_step ...

  7. 【学习笔记】tensorflow基础

    目录 认识Tensorflow Tensorflow特点 下载以及安装 Tensorflow初体验 Tensorflow进阶 图 op 会话 Feed操作 张量 变量 可视化学习Tensorboard ...

  8. TensorFlow API 汉化

    TensorFlow API 汉化 模块:tf   定义于tensorflow/__init__.py. 将所有公共TensorFlow接口引入此模块. 模块 app module:通用入口点脚本. ...

  9. tensorflow加载embedding模型进行可视化

    1.功能 采用python的gensim模块训练的word2vec模型,然后采用tensorflow读取模型可视化embedding向量 ps:采用C++版本训练的w2v模型,python的gensi ...

随机推荐

  1. linux (centos 6.4)下编译安装git

    是时候动手尝试下 Git 了,不过得先安装好它.有许多种安装方式,主要分为两种,一种是通过编译源代码来安装:另一种是使用为特定平台预编译好的安装包(yum install git). 若是条件允许,从 ...

  2. C++中的乱七八糟问题

    1   在编写的c++程序中,如果是窗口,有时会一闪就消失了,如果不想让其消失,在程序结尾处添加: #include“iostream.h” system("pause"); 分析 ...

  3. node nodemailer

    需求:通过nodejs发送邮件 一般都是用nodemailer这个模块.目前有0.7和1.0两个版本,网上的很多教程和代码,大都是按照0.7写的,自己做的时候需要注意看README.md 支持的ser ...

  4. [CentOS]Centos设置PATH全局变量

    PATH确认方法 $ echo $PATH 根据优先级先后顺序用:分割,因此可以复数指定 PATH设定方法(临时) $ export PATH=$PATH:/usr/local/scala/bin P ...

  5. java keytool生成ssl加密密钥

    教程:http://www.cnblogs.com/getherBlog/p/3930317.html 其中用到几个命令: keytool -genkeypair -alias certificate ...

  6. Spring Boot 2 实践记录之 MySQL + MyBatis 配置

    如果不需要连接池,那么只需要简单的在pom文件中,添加mysql依赖: <dependency> <groupId>mysql</groupId> <arti ...

  7. 【加密算法】3DES

    一.简介 3DES(或称为Triple DES)是三重数据加密算法(TDEA,Triple Data Encryption Algorithm)块密码的通称.它相当于是对每个数据块应用三次DES加密算 ...

  8. ASP.NET MVC 全局异常

    先新建一个过滤器ExceptionHandleErrorAttribute.cs 内容如下: using System; using System.Net; using System.Web; usi ...

  9. asp.net core 使用identityServer4的密码模式来进行身份认证(一)

    IdentityServer4是ASP.NET Core的一个包含OpenID和OAuth 2.0协议的框架.具体Oauth 2.0和openId请百度. 前言本博文适用于前后端分离或者为移动产品来后 ...

  10. ASP.NET MVC 扩展HtmlHelper类为 js ,css 资源文件添加版本号

    写在前面 在项目部署当中会需要更新 css 文件或 js 等资源文件,为了避免由于浏览器缓存的原因无法加载新的 css 或 js ,一般的做法是在资源文件的后面加上一个版本号来解决,这样浏览器就会去服 ...