View source on GitHub |
Represents options for tf.data.Dataset.
tf.data.Options()
An Options
object can be, for instance, used to control which graph optimizations to apply or whether to use performance modeling to dynamically tune the parallelism of operations such as tf.data.Dataset.map
or tf.data.Dataset.interleave
.
After constructing an Options
object, use dataset.with_options(options)
to apply the options to a dataset.
dataset = tf.data.Dataset.range(3) options = tf.data.Options() # Set options here. dataset = dataset.with_options(options)
Attributes | |
---|---|
experimental_deterministic | Whether the outputs need to be produced in deterministic order. If None, defaults to True. |
experimental_distribute | The distribution strategy options associated with the dataset. See tf.data.experimental.DistributeOptions for more details. |
experimental_external_state_policy | This option can be used to override the default policy for how to handle external state when serializing a dataset or checkpointing its iterator. There are three settings available - IGNORE: in which we completely ignore any state; WARN: We warn the user that some state might be thrown away; FAIL: We fail if any state is being captured. |
experimental_optimization | The optimization options associated with the dataset. See tf.data.experimental.OptimizationOptions for more details. |
experimental_slack | Whether to introduce 'slack' in the last prefetch of the input pipeline, if it exists. This may reduce CPU contention with accelerator host-side activity at the start of a step. The slack frequency is determined by the number of devices attached to this input pipeline. If None, defaults to False. |
experimental_stats | The statistics options associated with the dataset. See tf.data.experimental.StatsOptions for more details. |
experimental_threading | The threading options associated with the dataset. See tf.data.experimental.ThreadingOptions for more details. |
merge
merge( options )
Merges itself with the given tf.data.Options
.
The given tf.data.Options
can be merged as long as there does not exist an attribute that is set to different values in self
and options
.
Args | |
---|---|
options | a tf.data.Options to merge with |
Raises | |
---|---|
ValueError | if the given tf.data.Options cannot be merged |
Returns | |
---|---|
New tf.data.Options() object which is the result of merging self with the input tf.data.Options . |
__eq__
__eq__( other )
Return self==value.
__ne__
__ne__( other )
Return self!=value.
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/data/Options