Skip to content

Instantly share code, notes, and snippets.

@solaris33
Last active April 20, 2019 15:29
Show Gist options
  • Save solaris33/5d7df190d66c1741cdb5173a04c1648e to your computer and use it in GitHub Desktop.
Save solaris33/5d7df190d66c1741cdb5173a04c1648e to your computer and use it in GitHub Desktop.
import tensorflow as tf
i = tf.constant(0)
def cond(i):
return tf.less(i, 10)
def body(i):
return tf.add(i, 1)
result = tf.while_loop(cond, body, [i])
with tf.Session() as sess:
print(sess.run(result))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment