MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / shuffle_batch_join

Function shuffle_batch_join

tensorflow/python/training/input.py:1419–1509  ·  view source on GitHub ↗

Create batches by randomly shuffling tensors. 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.compat.v1.train.shuffle_batch()`. This version enqueues a differen

(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)

Source from the content-addressed store, hash-verified

1417 "`tf.data.Dataset.interleave(...).shuffle(min_after_dequeue).batch"
1418 "(batch_size)`.")
1419def shuffle_batch_join(tensors_list, batch_size, capacity,
1420 min_after_dequeue, seed=None, enqueue_many=False,
1421 shapes=None, allow_smaller_final_batch=False,
1422 shared_name=None, name=None):
1423 """Create batches by randomly shuffling tensors.
1424
1425 The `tensors_list` argument is a list of tuples of tensors, or a list of
1426 dictionaries of tensors. Each element in the list is treated similarly
1427 to the `tensors` argument of `tf.compat.v1.train.shuffle_batch()`.
1428
1429 This version enqueues a different list of tensors in different threads.
1430 It adds the following to the current `Graph`:
1431
1432 * A shuffling queue into which tensors from `tensors_list` are enqueued.
1433 * A `dequeue_many` operation to create batches from the queue.
1434 * A `QueueRunner` to `QUEUE_RUNNER` collection, to enqueue the tensors
1435 from `tensors_list`.
1436
1437 `len(tensors_list)` threads will be started, with thread `i` enqueuing
1438 the tensors from `tensors_list[i]`. `tensors_list[i1][j]` must match
1439 `tensors_list[i2][j]` in type and shape, except in the first dimension if
1440 `enqueue_many` is true.
1441
1442 If `enqueue_many` is `False`, each `tensors_list[i]` is assumed
1443 to represent a single example. An input tensor with shape `[x, y, z]`
1444 will be output as a tensor with shape `[batch_size, x, y, z]`.
1445
1446 If `enqueue_many` is `True`, `tensors_list[i]` is assumed to
1447 represent a batch of examples, where the first dimension is indexed
1448 by example, and all members of `tensors_list[i]` should have the
1449 same size in the first dimension. If an input tensor has shape `[*, x,
1450 y, z]`, the output will have shape `[batch_size, x, y, z]`.
1451
1452 The `capacity` argument controls the how long the prefetching is allowed to
1453 grow the queues.
1454
1455 The returned operation is a dequeue operation and will throw
1456 `tf.errors.OutOfRangeError` if the input queue is exhausted. If this
1457 operation is feeding another input queue, its queue runner will catch
1458 this exception, however, if this operation is used in your main thread
1459 you are responsible for catching this yourself.
1460
1461 If `allow_smaller_final_batch` is `True`, a smaller batch value than
1462 `batch_size` is returned when the queue is closed and there are not enough
1463 elements to fill the batch, otherwise the pending elements are discarded.
1464 In addition, all output tensors' static shapes, as accessed via the
1465 `shape` property will have a first `Dimension` value of `None`, and
1466 operations that depend on fixed batch_size would fail.
1467
1468 Args:
1469 tensors_list: A list of tuples or dictionaries of tensors to enqueue.
1470 batch_size: An integer. The new batch size pulled from the queue.
1471 capacity: An integer. The maximum number of elements in the queue.
1472 min_after_dequeue: Minimum number elements in the queue after a
1473 dequeue, used to ensure a level of mixing of elements.
1474 seed: Seed for the random shuffling within the queue.
1475 enqueue_many: Whether each tensor in `tensor_list_list` is a single
1476 example.

Callers

nothing calls this directly

Calls 1

_shuffle_batch_joinFunction · 0.85

Tested by

no test coverage detected