1.测试tensorboard

# tensorflow2.1.0+win10
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np

with tf.name_scope(name='filed') as scope:
    m1 = tf.constant(np.random.randint(0, 10, size=(2, 3)), name='m1')    
    m2 = tf.constant(np.random.randint(0, 10, size=(3, 5)), name='m2')
    pro = tf.matmul(m1, m2, name='product')

sess = tf.Session()
tf.summary.FileWriter('./logs', sess.graph)
sess.run(pro)
sess.close()

  执行上面的代码,会生成文件

tensorboard_tensorflow

进入logs所在的路径,cmd,输入tensorboard --logdir logs

tensorboard_学习_02

 在浏览器中输入http://localhost:6006/就可以打开

 tensorboard_tensorflow_03