定义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. pytest 常用命令行选项(一)

    pytest有丰富的命令行选项,以满足不同的需要,下面对常用的命令行选项作下简单介绍.  上文已经使用过-v选项,还有很多选项,你可以使用pytest --help查看全部选项.如下图: 1.--co ...

  2. Android学习整理之Activity篇

    一.Activity概念介绍 activity属于android的四大组件之一(其他的三个: Content provider,Broadcast receiver,Service),它可以理解为一个 ...

  3. Scala偏函数与部分函数

    函数 1.部分函数 部分应用函数(Partial Applied Function)是缺少部分参数的函数,是一个逻辑上概念. def sum(x: Int, y: Int, z: Int) = x + ...

  4. D3_book 7 area

    <!-- area的例子csv使用node.js提供的 --> <!DOCTYPE html> <meta charset="utf-8"> & ...

  5. [ajax] quick double or multiple click ajax submit cause chrome explorer's error snatshot

    快速点击ajax提交,引发的错误截图1: snapshot -2:

  6. Ajax请求php返回json对象数据中包含有数字索引和字符串索引,在for in循环中取出数据的顺序问题

    //php中的数组数据格式 Array ( [all] => Array ( [title] => ALL [room_promotion_id] => all ) [best_av ...

  7. EBS MOAC相关

    http://blog.csdn.net/rfb0204421/article/details/9306929 支持MOAC功能的Form开发步骤 分类: FORM2013-07-12 10:01 1 ...

  8. ASP.NET WEB API 返回JSON 出现2个双引号问题

    前言          在使用ASP.NET WEB API时,我想在某个方法返回JSON格式的数据,于是首先想到的就是手动构建JSON字符串,如:"{\"result\" ...

  9. ActiveMq 总结(二)

    4.2.6 MessageConsumer MessageConsumer是一个由Session创建的对象,用来从Destination接收消息. 4.2.6.1 创建MessageConsumer ...

  10. Spring Boot 学习系列(10)—SpringBoot+JSP的使

    此文已由作者易国强授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 解决问题 随着spring boot 框架的逐步使用,我们期望对于一些已有的系统进行改造,做成通用的脚手架, ...