Skip to content

Instantly share code, notes, and snippets.

@randcode-generator
Created November 15, 2019 17:29
Show Gist options
  • Save randcode-generator/c60853a0edbdc0e31f0f5a355237e6c1 to your computer and use it in GitHub Desktop.
Save randcode-generator/c60853a0edbdc0e31f0f5a355237e6c1 to your computer and use it in GitHub Desktop.
import tensorflow as tf
with tf.name_scope("myvars"):
a = tf.Variable(0.0, name="a")
tf.summary.scalar('apple', a)
b = tf.Variable(0.0, name="b")
tf.summary.scalar('bananas', b)
training_epochs = 10
with tf.Session() as sess:
merged = tf.summary.merge_all()
train_writer = tf.summary.FileWriter('./train', sess.graph)
sess.run(tf.global_variables_initializer())
for epoch in range(training_epochs):
a_op = a.assign_add(10)
b_op = b.assign_add(100)
_, _, summary = sess.run([a_op, b_op, merged])
train_writer.add_summary(summary, epoch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment