炼数成金Tensorflow学习笔记之5.3_tensorboard网络运行
代码及分析
"""
Created on Fri Mar 27 18:20:16 2020
@author: 寒火qwer
"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
tf.reset_default_graph()
mnist = input_data.read_data_sets('.\MNIST_data', one_hot=True)
def variable_summary(var):
with tf.name_scope('summary'):
with tf.name_scope('mean'):
mean = tf.reduce_mean(var)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('mean', mean)
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('max', tf.reduce_max(var))