答案 0 :(得分:1)
使这项工作最简单的方法是将out1
加入queue2
以及op1(out1)
的结果。以下是使用两个tf.FIFOQueue
队列的一个粗略示例:假设全部:
queue1 = tf.FIFOQueue(dtypes=[tf.float32])
# First component will store `out1`; second will store `op1(out1)`.
queue2 = tf.FIFOQueue(dtypes=[tf.float32, tf.float32])
# Define an op that enqueues to `queue1`.
enqueue1_op = ...
out1 = queue1.dequeue()
processed_out1 = op1(out1)
# Define an op that enqueues `out1` and `processed_out1` together to `queue2`.
enqueue2_op = queue2.enqueue([out1, processed_out1])
dequeued_out1, dequeued_processed_out1 = queue2.dequeue()
result = tf.add(dequeued_out1, dequeued_processed_out1)