Merge pull request #45495 from jackd:jackd/dataset-determinism-docs

PiperOrigin-RevId: 346841847
Change-Id: I576361c3f25487673500e0e8ca9fbf275923d909
This commit is contained in:
TensorFlower Gardener 2020-12-10 12:48:14 -08:00
commit 94bef4cb74

View File

@ -1784,6 +1784,12 @@ name=None))
... num_parallel_calls=tf.data.AUTOTUNE, ... num_parallel_calls=tf.data.AUTOTUNE,
... deterministic=False) ... deterministic=False)
The order of elements yielded by this transformation is deterministic if
`deterministic=True`. If `map_func` contains stateful operations and
`num_parallel_calls > 1`, the order in which that state is accessed is
undefined, so the values of output elements may not be deterministic
regardless of the `deterministic` flag value.
Args: Args:
map_func: A function mapping a dataset element to another dataset element. map_func: A function mapping a dataset element to another dataset element.
num_parallel_calls: (Optional.) A `tf.int32` scalar `tf.Tensor`, num_parallel_calls: (Optional.) A `tf.int32` scalar `tf.Tensor`,
@ -1792,11 +1798,10 @@ name=None))
`tf.data.AUTOTUNE` is used, then the number of parallel `tf.data.AUTOTUNE` is used, then the number of parallel
calls is set dynamically based on available CPU. calls is set dynamically based on available CPU.
deterministic: (Optional.) A boolean controlling whether determinism deterministic: (Optional.) A boolean controlling whether determinism
should be traded for performance by allowing elements to be produced out should be traded for performance by allowing elements to be yielded out
of order. If `deterministic` is `None`, the of order. If `deterministic` is `None`, the
`tf.data.Options.experimental_deterministic` dataset option (`True` by `tf.data.Options.experimental_deterministic` dataset option (`True` by
default) is used to decide whether to produce elements default) is used to decide whether to run deterministically.
deterministically.
Returns: Returns:
Dataset: A `Dataset`. Dataset: A `Dataset`.
@ -1925,8 +1930,7 @@ name=None))
should be traded for performance by allowing elements to be produced out should be traded for performance by allowing elements to be produced out
of order. If `deterministic` is `None`, the of order. If `deterministic` is `None`, the
`tf.data.Options.experimental_deterministic` dataset option (`True` by `tf.data.Options.experimental_deterministic` dataset option (`True` by
default) is used to decide whether to produce elements default) is used to decide whether to run deterministically.
deterministically.
Returns: Returns:
Dataset: A `Dataset`. Dataset: A `Dataset`.