tensorflow定义了一个图结构:
代码:
a = tf.constant(3.0, name="a")b = tf.constant(4.0, name="b")c = tf.add(a, b, name="add")var = tf.Variable(tf.random_normal([2, 3], mean=0.0, stddev=1.0), name="variable")print(a, var)# 必须做一步显示的初始化op
init_op = tf.global_variables_initializer()with tf.Session() as sess:# 必须运行初始化opsess.run(init_op)# 把程序的图结构写入事件文件, graph:把指定的图写进事件文件当中filewriter = tf.summary.FileWriter("./tmp/summary/test/", graph=sess.graph)print(sess.run([c, var]))
summary:摘要
# 把程序的图结构写入事件文件, graph:把指定的图写进事件文件当中
filewriter = tf.summary.FileWriter("./tmp/summary/test/", graph=sess.graph)