tf.train.maybe_shuffle_batch
tf.train.maybe_shuffle_batch
tf.train.maybe_shuffle_batch
maybe_shuffle_batch( tensors, batch_size, capacity, min_after_dequeue, keep_input, num_threads=1, seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False, shared_name=None, name=None )
Defined in tensorflow/python/training/input.py
.
See the guide: Inputs and Readers > Input pipeline
Creates batches by randomly shuffling conditionally-enqueued tensors.
See docstring in shuffle_batch
for more details.
Args:
-
tensors
: The list or dictionary of tensors to enqueue. -
batch_size
: The new batch size pulled from the queue. -
capacity
: An integer. The maximum number of elements in the queue. -
min_after_dequeue
: Minimum number elements in the queue after a dequeue, used to ensure a level of mixing of elements. -
keep_input
: Abool
Tensor. This tensor controls whether the input is added to the queue or not. If it is a scalar and evaluatesTrue
, thentensors
are all added to the queue. If it is a vector andenqueue_many
isTrue
, then each example is added to the queue only if the corresonding value inkeep_input
isTrue
. This tensor essentially acts as a filtering mechanism. -
num_threads
: The number of threads enqueuingtensor_list
. -
seed
: Seed for the random shuffling within the queue. -
enqueue_many
: Whether each tensor intensor_list
is a single example. -
shapes
: (Optional) The shapes for each example. Defaults to the inferred shapes fortensor_list
. -
allow_smaller_final_batch
: (Optional) Boolean. IfTrue
, allow the final batch to be smaller if there are insufficient items left in the queue. -
shared_name
: (Optional) If set, this queue will be shared under the given name across multiple sessions. -
name
: (Optional) A name for the operations.
Returns:
A list or dictionary of tensors with the types as tensors
.
Raises:
-
ValueError
: If theshapes
are not specified, and cannot be inferred from the elements oftensors
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/train/maybe_shuffle_batch