How can I schedule Tensor Flow to push an increasing number into a queue?
I just do this for training purposes, so I would prefer that you are similar to what I am doing (and correcting what I am doing wrong). This is my code:
import tensorflow as tf
queue = tf.RandomShuffleQueue(capacity=10, min_after_dequeue=1, dtypes=tf.float32)
push_var = tf.Variable(initial_value=1.0, trainable=False)
add = push_var.assign_add(1)
push = queue.enqueue(add)
pop = queue.dequeue()
sess = tf.InteractiveSession()
tf.initialize_all_variables().run()
sess.run(push)
sess.run(push)
sess.run(push)
sess.run(push)
sess.run(push)
sess.run(push)
sess.run(push)
print sess.run(pop)
print sess.run(pop)
sess.close()
Conclusion:
8
8
I expect it to be 2 random numbers between 2 and 8. Instead, it always gives the current value of the variable.
Is it because instead of clicking on the actual value of the variable, I instead click on the variable pointer? Tensor flow documentation says assign_addreturns
A tensor that will hold the new value of this variable after the addition is complete.
, Tensor Flow. ( - TensorFlow), ! .
EDIT:
push = queue.enqueue(add) push = queue.enqueue(add + 0) . - ?