Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- result = tf.constant([0])
- i = tf.constant(0)
- c_1 = lambda i,result: tf.less(i, 10)
- def b_1(i,result):
- j = tf.constant(0)
- c_2 = lambda i,j,res: tf.less(j, 10)
- result += 1
- def b_2(i, j,res):
- res += 1
- return i, tf.add(j, 1), res
- loop_2 = tf.while_loop(c_2, b_2, [i,j,result])
- return tf.add(i, 1), result
- loop_1 = tf.while_loop(c_1, b_1, [i,result])
- with tf.Session() as sess:
- print(sess.run(loop_1))
Add Comment
Please, Sign In to add comment