A function mapping a nested structure of tensors to another
nested structure of tensors.
batch_size
A tf.int64 scalar tf.Tensor, representing the number of
consecutive elements of this dataset to combine in a single batch.
num_parallel_batches
(Optional.) A tf.int64 scalar tf.Tensor,
representing the number of batches to create in parallel. On one hand,
higher values can help mitigate the effect of stragglers. On the other
hand, higher values can increase contention if CPU is scarce.
drop_remainder
(Optional.) A tf.bool scalar tf.Tensor, representing
whether the last batch should be dropped in case its size is smaller than
desired; the default behavior is not to drop the smaller batch.
num_parallel_calls
(Optional.) A tf.int32 scalar tf.Tensor,
representing the number of elements to process in parallel. If not
specified, batch_size * num_parallel_batches elements will be processed
in parallel. If the value tf.data.AUTOTUNE is used, then
the number of parallel calls is set dynamically based on available CPU.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.data.experimental.map_and_batch_with_legacy_function\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/data/experimental/ops/batching.py#L145-L202) |\n\nFused implementation of `map` and `batch`. (deprecated) \n\n tf.compat.v1.data.experimental.map_and_batch_with_legacy_function(\n map_func,\n batch_size,\n num_parallel_batches=None,\n drop_remainder=False,\n num_parallel_calls=None\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use \\`tf.data.experimental.map_and_batch()\n| **Note:** This is an escape hatch for existing uses of `map_and_batch` that do not work with V2 functions. New uses are strongly discouraged and existing uses should migrate to `map_and_batch` as this method will not be removed in V2.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `map_func` | A function mapping a nested structure of tensors to another nested structure of tensors. |\n| `batch_size` | A [`tf.int64`](../../../../../tf#int64) scalar [`tf.Tensor`](../../../../../tf/Tensor), representing the number of consecutive elements of this dataset to combine in a single batch. |\n| `num_parallel_batches` | (Optional.) A [`tf.int64`](../../../../../tf#int64) scalar [`tf.Tensor`](../../../../../tf/Tensor), representing the number of batches to create in parallel. On one hand, higher values can help mitigate the effect of stragglers. On the other hand, higher values can increase contention if CPU is scarce. |\n| `drop_remainder` | (Optional.) A [`tf.bool`](../../../../../tf#bool) scalar [`tf.Tensor`](../../../../../tf/Tensor), representing whether the last batch should be dropped in case its size is smaller than desired; the default behavior is not to drop the smaller batch. |\n| `num_parallel_calls` | (Optional.) A [`tf.int32`](../../../../../tf#int32) scalar [`tf.Tensor`](../../../../../tf/Tensor), representing the number of elements to process in parallel. If not specified, `batch_size * num_parallel_batches` elements will be processed in parallel. If the value [`tf.data.AUTOTUNE`](../../../../../tf/data#AUTOTUNE) is used, then the number of parallel calls is set dynamically based on available CPU. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](../../../../../tf/data/Dataset#apply). ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|------------------------------------------------------------------------|\n| `ValueError` | If both `num_parallel_batches` and `num_parallel_calls` are specified. |\n\n\u003cbr /\u003e"]]