Skip to content

Instantly share code, notes, and snippets.

@Ouwen
Last active July 27, 2018 05:41
Show Gist options
  • Save Ouwen/c073165321b8c3987d1c8f4552df0538 to your computer and use it in GitHub Desktop.
Save Ouwen/c073165321b8c3987d1c8f4552df0538 to your computer and use it in GitHub Desktop.
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
# Add a single variable to our graph
v = tf.get_variable(name="v", shape=(), initializer=tf.glorot_uniform_initializer())
sess = tf.Session(graph=g1)
sess.run(v.initializer) # Run just the initializer on our variable
# sess.run(tf.global_variables_initializer()) # This will initialize all variables
print(sess.run(v))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment