定义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. hdu 4974 贪心

    http://acm.hdu.edu.cn/showproblem.php?pid=4974 n个人进行选秀,有一个人做裁判,每次有两人进行对决,裁判可以选择为两人打分,可以同时加上1分,或者单独为一 ...

  2. ACL登陆认证

    前篇文章ACL授权实例介绍了授权,授权完成之后,就要进行认证.ACL的认证主要分为登陆认证与即时认证.所谓登录认证就是在用户登陆的时候,进行信息认证.根据用户Id,加载上来该用户所拥有的权限模块:而即 ...

  3. log4j自动加载原理

    java虚拟机加载log4j的类(LogManager.class)后,执行静态代码块,这个类中的静态代码块,会load log4j的配置文件,依次加载log4j.xml,log4j.properti ...

  4. 集合(二)LinkedList

    上一篇中讲解了ArrayList,本篇文章讲解一下LinkedList的实现. LinkedList是基于链表实现的,所以先讲解一下什么是链表.链表原先是C/C++的概念,是一种线性的存储结构,意思是 ...

  5. [ACM_模拟] UVA 12504 Updating a Dictionary [字符串处理 字典增加、减少、改变问题]

      Updating a Dictionary  In this problem, a dictionary is collection of key-value pairs, where keys ...

  6. [ACM_数据结构] HDU 1166 敌兵布阵 线段树 或 树状数组

    #include<iostream> #include<cstdio> #include<memory.h> using namespace std; ]; //- ...

  7. oauth入门

    oauth可以支持跨网站的数据传输.假设一个用户把照片上传到faji网站,然后想登录到beppa网站(照片打印),把faji的上照片打印出来. 她当然可以自己把照片取下来再上传上去,不过比较麻烦. 使 ...

  8. 逆变(contravariant)与协变(covariant)

    逆变(contravariant)与协变(covariant)是C#4新增的概念,许多书籍和博客都有讲解,我觉得都没有把它们讲清楚,搞明白了它们,可以更准确地去定义泛型委托和接口,这里我尝试画图详细解 ...

  9. 基于duilib的虚拟列表实现

    本文由作者邹启文授权网易云社区发布. 在邮箱大师选择duilib作为UI开发库后,我们面临这样一个问题.随着时间的积累,用户数据会越来越多,如何保证我们的软件在展示这些数据时依然保持非常好的体验? 原 ...

  10. pageadmin CMS网站制作教程:栏目单页内容如何修改

    pageadmin CMS网站制作教程:栏目单页内容如何修改 一般情况下,如公司介绍,联系方式等介绍内页面都属于单页,单页内容可以直接在栏目设置界面进行修改,如下 1.对栏目单页内容进行设置,登录后台 ...