zoukankan      html  css  js  c++  java
  • tensorflow summary

    定义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)
  • 相关阅读:
    解决margin 外边距合并问题
    tsx 校验 以及写法
    tsx 引入文件找不到
    Ubuntu 16.04安装和卸载软件命令
    Java8 中使用Stream 让List 转 Map使用总结
    Java8 Stream流式编程浅析
    浅析IOC 和 DI
    [ Java面试题 ]Java 开发岗面试知识点解析
    Intellij Idea 常用快捷键总结+实用小技巧
    Intellij Idea基础设置
  • 原文地址:https://www.cnblogs.com/callyblog/p/9549993.html
Copyright © 2011-2022 走看看