enqueue
enqueue(
vals,
name=None
)
在队列里入列一个元素
当操作执行时,如果这个队列是满的则它将阻止,直到元素已被入队。
在运行时,如果队列在执行之前或执行过程中的队列是tf.QueueBase.close,则此操作可能会引发错误tf.errors.CancelledError。如果该操作被阻塞,并且要么(i)队列通过具有cancel_pending_enque.=True的闭合操作关闭,要么(ii)会话为tf.Session.close、f.errors.CancelledError将被触发。
参数:
vals
:一个tensor,tensors的元组列表 ,或包含入队值的字典。name
: 操作名字(可选)
返回:
将张量的新元组入列到队列的操作。
enqueue_many
enqueue_many(
vals,
name=None
)
将零或多个元素入队到此队列
该操作将每个分量张量沿零维切片,以形成多个队列元素。在零维中,所有在vals中
的张量必须具有相同的大小。
如果此操作执行时队列已满,则它将阻塞,直到所有元素都已入队。
在运行时,如果队列在执行之前或执行过程中的队列是tf.QueueBase.close,如果在运行之前关闭该队列,则将引发tf.errors.CancelledError。如果该操作被阻塞,并且要么(i)队列通过具有cancel_pending_enqueues
=True的闭合操作关闭,要么(ii)会话为tf.Session.close、tf.errors.CancelledError将被引发。
参数:
vals
: 一个tensor,tensors元组的列表,或一个字典 从中获取队列元素的字典name
: A name for the operation (optional).
返回:
将张量的一批元组排到队列中的操作。
from_list
from_list(
index,
queues
)
从queues[index]中使用队列引用创建队列
参数:
index
: 一个整数标量,决定输入选择范围queues
: 一个QueueBase对象列表
返回:
一个QueueBase对象
抛出:
TypeError
: 当queues不是queues对象的列表,或当queues数据类型并非都相同
。
is_closed
is_closed(name=None)
Returns true if queue is closed.
This operation returns true if the queue is closed and false if the queue is open.
Args:
name
: A name for the operation (optional).
Returns:
True if the queue is closed and false if the queue is open.
size
size(name=None)
Compute the number of elements in this queue.
Args:
name
: A name for the operation (optional).
Returns:
A scalar tensor containing the number of elements in this queue.