Skip to content

Instantly share code, notes, and snippets.

@d3lm
Created January 9, 2019 16:28
Show Gist options
  • Save d3lm/2e0521de7c0c0920683658e022d577b1 to your computer and use it in GitHub Desktop.
Save d3lm/2e0521de7c0c0920683658e022d577b1 to your computer and use it in GitHub Desktop.
import tf_api as tf
# create default graph
tf.Graph().as_default()
# construct computational graph by creating some nodes
a = tf.Constant(15)
b = tf.Constant(5)
prod = tf.multiply(a, b)
sum = tf.add(a, b)
res = tf.divide(prod, sum)
# create a session object
session = tf.Session()
# run computational graph to compute the output for 'res'
out = session.run(res)
print(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment