简体   繁体   English

无法理解tensorflow shuffle_batch enqueue_many = False

[英]Trouble understanding tensorflow shuffle_batch enqueue_many=False

I am reading the Tensorflow documentation and the code for the Cifar10 example. 我正在阅读Tensorflow文档和Cifar10示例的代码。 This bit is currently racking my brain: 这一点目前正在我的脑海:

# Creates batches of 32 images and 32 labels.
image_batch, label_batch = tf.train.shuffle_batch(
  [single_image, single_label],
  batch_size=32,
  num_threads=4,
  capacity=50000,
  min_after_dequeue=10000)

We are passing in a single image, and somehow a batch of images results?? 我们传递单个图像,以某种方式产生一批图像? What is going on here? 这里发生了什么?

The single_image or single_label tensor would usually refer to an operation that retrieves the next value from a queue. single_imagesingle_label张量通常将引用从队列中检索下一个值的操作。 To create a batch, it would then for example retrieve the batch size (eg 32) of values from those tensors if it wasn't shuffled. 为了创建一个批处理,如果不进行混洗,它将例如从那些张量中检索值的批处理大小(例如32)。 In the case where it is shuffled it will retrieve between min_after_dequeue and capacity values. 在改组的情况下,它将在min_after_dequeuecapacity值之间min_after_dequeue检索。

Note that the now suggested approach is to use the Dataset API instead. 请注意,现在建议的方法是改用Dataset API Although it will work in a very similar way there too. 尽管它在那里也会以非常相似的方式工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM