Tf.data.iterator.get_next(): How To Advance In Tf.while_loop?
Currently I try to implement all training in a Tensorflow while loop, but I've got problems with the Tensorflow dataset API's Iterator. Usually, when calling sess.run(), Iterator.g
Solution 1:
You need to call iterator.get_next()
every time you want to "iterate inside one run".
For instance in your toy example, just replace your body_op
with:
body_op=lambda i: tf.Print(i, [iterator.get_next()], message="This is sample: ")
# This is sample: [0]# This is sample: [1]# This is sample: [2]# This is sample: [3]# This is sample: [4]
Post a Comment for "Tf.data.iterator.get_next(): How To Advance In Tf.while_loop?"