简体   繁体   中英

Trouble understanding tensorflow shuffle_batch enqueue_many=False

I am reading the Tensorflow documentation and the code for the Cifar10 example. 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. 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. In the case where it is shuffled it will retrieve between min_after_dequeue and capacity values.

Note that the now suggested approach is to use the Dataset API instead. Although it will work in a very similar way there too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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