Skip to content

Instantly share code, notes, and snippets.

@amobiny
Created June 10, 2018 04:43
Show Gist options
  • Save amobiny/0a526474d27554c9034c7af520347d72 to your computer and use it in GitHub Desktop.
Save amobiny/0a526474d27554c9034c7af520347d72 to your computer and use it in GitHub Desktop.
import tensorflow as tf
tf.reset_default_graph() # To clear the defined variables and operations of the previous cell
# create graph
a = tf.constant(2, name="a")
b = tf.constant(3, name="b")
c = tf.add(a, b, name="addition")
# creating the writer out of the session
# writer = tf.summary.FileWriter('./graphs', tf.get_default_graph())
# launch the graph in a session
with tf.Session() as sess:
# or creating the writer inside the session
writer = tf.summary.FileWriter('./graphs', sess.graph)
print(sess.run(c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment