|View source on GitHub|
Fused implementation of
tf.data.experimental.map_and_batch_with_legacy_function( map_func, batch_size, num_parallel_batches=None, drop_remainder=False, num_parallel_calls=None )
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.
map_func: A function mapping a nested structure of tensors to another nested structure of tensors.
tf.Tensor, representing the number of consecutive elements of this dataset to combine in a single batch.
num_parallel_batches: (Optional.) A
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.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.Tensor, representing the number of elements to process in parallel. If not specified,
batch_size * num_parallel_batcheselements will be processed in parallel. If the value
tf.data.experimental.AUTOTUNEis used, then the number of parallel calls is set dynamically based on available CPU.
Dataset transformation function, which can be passed to
ValueError: If both