查看两个带有参数的函数签名
tf.train.shuffle_batch_join(
tensors_list,
batch_size,
capacity,
min_after_dequeue,
seed=None,
enqueue_many=False,
shapes=None,
allow_smaller_final_batch=False,
shared_name=None,
name=None
)
和
tf.train.shuffle_batch(
tensors,
batch_size,
capacity,
min_after_dequeue,
num_threads=1,
seed=None,
enqueue_many=False,
shapes=None,
allow_smaller_final_batch=False,
shared_name=None,
name=None
)
参数之间唯一的区别是 num_threads
直观地表示 tf.train.shuffle_batch
可以用多个线程或进程处理,除此之外,它们似乎做几乎相同的工作。
我想知道除了批处理的多重处理之外,是否存在根本的区别,人们可能会选择一个而不是另一个。
最佳答案
引用自 shuffle_batch_join TF 文档:
The tensors_list argument is a list of tuples of tensors, or a list of dictionaries of tensors. Each element in the list is treated similarly to the tensors argument of tf.train.shuffle_batch().
基本上,shuffle_batch_join 期望:
- 接收张量列表
- 对列表的每个成员执行 shuffle_batch
- 返回与 tensors_list[i] 具有相同数量和类型的张量列表。
请注意,如果您使用 shuffle_batch_join :
len(tensors_list) threads will be started, with thread i enqueuing the tensors from tensors_list[i]. tensors_list[i1][j] must match tensors_list[i2][j] in type and shape, except in the first dimension if enqueue_many is true.
关于python - tf.train.shuffle_batch_join 和 tf.train.shuffle_batch 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51276877/