1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import tensorflow as tf from skimage import io
a = tf.placeholder(tf.int32, shape=[]) b = tf.constant(1, dtype=tf.int32) y = a+b sess=tf.Session() sess.run(tf.global_variables_initializer())
summary_writer = tf.summary.FileWriter("./logs",sess.graph)
img = io.imread("data.png") img = tf.reshape(img,[1,28,28,1]) tf.summary.image('img',img)
tf.summary.scalar("a", a) tf.summary.scalar("b", b)
summarry = tf.summary.merge_all() for i in range(10): eval_summary = sess.run(summarry, feed_dict={a: i}) summary_writer.add_summary( eval_summary , global_step=i)
|