1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| import tensorflow as tf
data=[ [1.1,[1]], [2.2,[2,2]], [3.3,[3,3,3]], [4.4,[4,4,4,4]] ]
with tf.Session() as sess: qr = tf.PaddingFIFOQueue(capacity=4, dtypes=[tf.float64,tf.uint8], shapes=[[],[None]])
en_qr_1 = qr.enqueue(data[0]) en_qr_2 = qr.enqueue(data[1]) en_qr_3 = qr.enqueue(data[2]) sess.run(en_qr_1) sess.run(en_qr_2) sess.run(en_qr_3) n=qr.size() num=sess.run(n)
de_qr = qr.dequeue_many(3) res = sess.run(de_qr)
print("\nres[0]:\n",res[0], "\nres[1]:\n",res[1], "\n num: \n",num)
|