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 el
(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)
| 1353 | "`tf.data.Dataset.filter(...).shuffle(min_after_dequeue).batch(batch_size)`" |
| 1354 | ".") |
| 1355 | def maybe_shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, |
| 1356 | keep_input, num_threads=1, seed=None, |
| 1357 | enqueue_many=False, shapes=None, |
| 1358 | allow_smaller_final_batch=False, shared_name=None, |
| 1359 | name=None): |
| 1360 | """Creates batches by randomly shuffling conditionally-enqueued tensors. |
| 1361 | |
| 1362 | See docstring in `shuffle_batch` for more details. |
| 1363 | |
| 1364 | Args: |
| 1365 | tensors: The list or dictionary of tensors to enqueue. |
| 1366 | batch_size: The new batch size pulled from the queue. |
| 1367 | capacity: An integer. The maximum number of elements in the queue. |
| 1368 | min_after_dequeue: Minimum number elements in the queue after a |
| 1369 | dequeue, used to ensure a level of mixing of elements. |
| 1370 | keep_input: A `bool` Tensor. This tensor controls whether the input is |
| 1371 | added to the queue or not. If it is a scalar and evaluates `True`, then |
| 1372 | `tensors` are all added to the queue. If it is a vector and `enqueue_many` |
| 1373 | is `True`, then each example is added to the queue only if the |
| 1374 | corresponding value in `keep_input` is `True`. This tensor essentially |
| 1375 | acts as a filtering mechanism. |
| 1376 | num_threads: The number of threads enqueuing `tensor_list`. |
| 1377 | seed: Seed for the random shuffling within the queue. |
| 1378 | enqueue_many: Whether each tensor in `tensor_list` is a single example. |
| 1379 | shapes: (Optional) The shapes for each example. Defaults to the |
| 1380 | inferred shapes for `tensor_list`. |
| 1381 | allow_smaller_final_batch: (Optional) Boolean. If `True`, allow the final |
| 1382 | batch to be smaller if there are insufficient items left in the queue. |
| 1383 | shared_name: (Optional) If set, this queue will be shared under the given |
| 1384 | name across multiple sessions. |
| 1385 | name: (Optional) A name for the operations. |
| 1386 | |
| 1387 | Returns: |
| 1388 | A list or dictionary of tensors with the types as `tensors`. |
| 1389 | |
| 1390 | Raises: |
| 1391 | ValueError: If the `shapes` are not specified, and cannot be |
| 1392 | inferred from the elements of `tensors`. |
| 1393 | |
| 1394 | @compatibility(eager) |
| 1395 | Input pipelines based on Queues are not supported when eager execution is |
| 1396 | enabled. Please use the `tf.data` API to ingest data under eager execution. |
| 1397 | @end_compatibility |
| 1398 | """ |
| 1399 | return _shuffle_batch( |
| 1400 | tensors, |
| 1401 | batch_size, |
| 1402 | capacity, |
| 1403 | min_after_dequeue, |
| 1404 | keep_input, |
| 1405 | num_threads=num_threads, |
| 1406 | seed=seed, |
| 1407 | enqueue_many=enqueue_many, |
| 1408 | shapes=shapes, |
| 1409 | allow_smaller_final_batch=allow_smaller_final_batch, |
| 1410 | shared_name=shared_name, |
| 1411 | name=name) |
| 1412 |
nothing calls this directly
no test coverage detected