1. 将想要命名的值添加代码及缩进
with tf.name_scope('input'):with tf.name_scope('train_data'):ph_train_data = tf.placeholder(tf.float32, [None, n_time_step, n_dim])with tf.name_scope('train_label'):ph_train_label = tf.placeholder(tf.float32, [None, n_classes])
2. 运行 session
init = tf.global_variables_initializer()
with tf.Session() as sess:sess.run(init)tf.summary.FileWriter("logs/", sess.graph)
3. 运行代码后,graph数据将自动保存在当前项目下的 "logs" 文件夹下
4. 打开cmd,文件夹转到要打开的 logs 所在项目,输入 tensorboard --logdir logs
复制网址到Google浏览器打开 (或者直接http://localhost:6006)即可看见生成的 Graph