Skip to content

Instantly share code, notes, and snippets.

@eiennohito
Created September 26, 2018 02:04
Show Gist options
  • Save eiennohito/037a42e24072ab4f8150e80c91b1ce86 to your computer and use it in GitHub Desktop.
Save eiennohito/037a42e24072ab4f8150e80c91b1ce86 to your computer and use it in GitHub Desktop.
import tensorflow as tf
import os
sess = tf.Session()
x = tf.placeholder(tf.float32, shape=[])
y = tf.sin(x)
tf.summary.scalar('y', y)
merged = tf.summary.merge_all()
os.makedirs('/tmp/tf-sin', exist_ok=True)
writer = tf.summary.FileWriter("/tmp/tf-sin")
for i in range(1000):
res = sess.run(merged, feed_dict={x: i * 0.01})
writer.add_summary(res, i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment