Created
May 8, 2017 18:14
-
-
Save guschmue/fef2018cefb327c45f7619e26f530837 to your computer and use it in GitHub Desktop.
simple_scalar_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import tensorflow as tf | |
out_dir = os.path.abspath(os.path.join(os.path.curdir, "runs", str(int(time.time())))) | |
if not os.path.exists(out_dir): | |
os.mkdir(out_dir) | |
x = tf.placeholder(tf.float32, name="x") | |
init_op = tf.global_variables_initializer() | |
summary_op = tf.summary.scalar("steps", x) | |
with tf.Session() as sess: | |
sess.run(init_op) | |
summary_writer = tf.summary.FileWriter(out_dir, sess.graph) | |
for step in range(10): | |
summary = sess.run(summary_op, feed_dict={x: step}) | |
summary_writer.add_summary(summary, step) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment