Skip to content

Instantly share code, notes, and snippets.

@Janus-Shiau
Created August 3, 2019 14:31
Show Gist options
  • Save Janus-Shiau/9bda7ac90dfa0460181feda85891d380 to your computer and use it in GitHub Desktop.
Save Janus-Shiau/9bda7ac90dfa0460181feda85891d380 to your computer and use it in GitHub Desktop.
import tensorflow as tf
var = tf.Variable(0, dtype=tf.int32)
counter = tf.add(var,1)
counter = tf.assign(var, counter)
with tf.Session() as sess:
tf.global_variables_initializer().run()
for i in range(5):
print(counter.eval())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment