Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow 如何使用可变长度序列从预加载的数据填充队列?_Tensorflow - Fatal编程技术网

Tensorflow 如何使用可变长度序列从预加载的数据填充队列?

Tensorflow 如何使用可变长度序列从预加载的数据填充队列?,tensorflow,Tensorflow,假设我将具有可变长度序列的输入数据加载到内存中: sentences = [ [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5 ], [0, 1, 2, 3, 4, 5 ] ] 我如何使用它来填充队列?例如,类似于: padding_q = tf.PaddingFIFOQueue( capacity=len(sentences), dtypes=[tf.in

假设我将具有可变长度序列的输入数据加载到内存中:

sentences = [
    [0, 1, 2, 3, 4, 5, 6, 7],
    [0, 1, 2, 3, 4, 5, 6, 7],
    [0, 1, 2, 3, 4, 5 ],
    [0, 1, 2, 3, 4, 5 ]
]
我如何使用它来填充队列?例如,类似于:

padding_q = tf.PaddingFIFOQueue(
    capacity=len(sentences),
    dtypes=[tf.int32], shapes=[[None]])
qr = tf.train.QueueRunner(padding_q, [the_wanted_op])
通缉令是什么样子的?它应该让一个句子排队,但四个队列必须让每个句子排队一次