tf.data.experimental.OptimizationOptions
Stay organized with collections
Save and categorize content based on your preferences.
Represents options for dataset optimizations.
tf.data.experimental.OptimizationOptions()
You can set the optimization options of a dataset through the
experimental_optimization
property of tf.data.Options
; the property is
an instance of tf.data.experimental.OptimizationOptions
.
options = tf.data.Options()
options.experimental_optimization.noop_elimination = True
options.experimental_optimization.map_vectorization.enabled = True
options.experimental_optimization.apply_default_optimizations = False
dataset = dataset.with_options(options)
Attributes |
apply_default_optimizations
|
Whether to apply default static optimizations. If False, only static optimizations that have been explicitly enabled will be applied.
|
autotune
|
Whether to automatically tune performance knobs. If None, defaults to True.
|
autotune_algorithm
|
When autotuning is enabled (through autotune ), identifies the algorithm to use for the autotuning optimization.
|
autotune_buffers
|
When autotuning is enabled (through autotune ), determines whether to also autotune buffer sizes for datasets with parallelism. If None, defaults to False.
|
autotune_cpu_budget
|
When autotuning is enabled (through autotune ), determines the CPU budget to use. Values greater than the number of schedulable CPU cores are allowed but may result in CPU contention. If None, defaults to the number of schedulable CPU cores.
|
filter_fusion
|
Whether to fuse filter transformations. If None, defaults to False.
|
filter_with_random_uniform_fusion
|
Whether to fuse filter dataset that predicts random_uniform < rate into a sampling dataset. If None, defaults to False.
|
hoist_random_uniform
|
Whether to hoist tf.random_uniform() ops out of map transformations. If None, defaults to False.
|
map_and_batch_fusion
|
Whether to fuse map and batch transformations. If None, defaults to True.
|
map_and_filter_fusion
|
Whether to fuse map and filter transformations. If None, defaults to False.
|
map_fusion
|
Whether to fuse map transformations. If None, defaults to False.
|
map_parallelization
|
Whether to parallelize stateless map transformations. If None, defaults to False.
|
map_vectorization
|
The map vectorization options associated with the dataset. See tf.data.experimental.MapVectorizationOptions for more details.
|
noop_elimination
|
Whether to eliminate no-op transformations. If None, defaults to True.
|
parallel_batch
|
Whether to parallelize copying of batch elements. If None, defaults to False.
|
shuffle_and_repeat_fusion
|
Whether to fuse shuffle and repeat transformations. If None, defaults to True.
|
Methods
__eq__
View source
__eq__(
other
)
Return self==value.
__ne__
View source
__ne__(
other
)
Return self!=value.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.data.experimental.OptimizationOptions\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/data/experimental/OptimizationOptions) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/data/experimental/ops/optimization_options.py#L57-L224) |\n\nRepresents options for dataset optimizations.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.data.experimental.OptimizationOptions`](/api_docs/python/tf/data/experimental/OptimizationOptions), \\`tf.compat.v2.data.experimental.OptimizationOptions\\`\n\n\u003cbr /\u003e\n\n tf.data.experimental.OptimizationOptions()\n\nYou can set the optimization options of a dataset through the\n`experimental_optimization` property of [`tf.data.Options`](../../../tf/data/Options); the property is\nan instance of [`tf.data.experimental.OptimizationOptions`](../../../tf/data/experimental/OptimizationOptions). \n\n options = tf.data.Options()\n options.experimental_optimization.noop_elimination = True\n options.experimental_optimization.map_vectorization.enabled = True\n options.experimental_optimization.apply_default_optimizations = False\n dataset = dataset.with_options(options)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `apply_default_optimizations` | Whether to apply default static optimizations. If False, only static optimizations that have been explicitly enabled will be applied. |\n| `autotune` | Whether to automatically tune performance knobs. If None, defaults to True. |\n| `autotune_algorithm` | When autotuning is enabled (through `autotune`), identifies the algorithm to use for the autotuning optimization. |\n| `autotune_buffers` | When autotuning is enabled (through `autotune`), determines whether to also autotune buffer sizes for datasets with parallelism. If None, defaults to False. |\n| `autotune_cpu_budget` | When autotuning is enabled (through `autotune`), determines the CPU budget to use. Values greater than the number of schedulable CPU cores are allowed but may result in CPU contention. If None, defaults to the number of schedulable CPU cores. |\n| `filter_fusion` | Whether to fuse filter transformations. If None, defaults to False. |\n| `filter_with_random_uniform_fusion` | Whether to fuse filter dataset that predicts random_uniform \\\u003c rate into a sampling dataset. If None, defaults to False. |\n| `hoist_random_uniform` | Whether to hoist [`tf.random_uniform()`](../../../tf/random/uniform) ops out of map transformations. If None, defaults to False. |\n| `map_and_batch_fusion` | Whether to fuse map and batch transformations. If None, defaults to True. |\n| `map_and_filter_fusion` | Whether to fuse map and filter transformations. If None, defaults to False. |\n| `map_fusion` | Whether to fuse map transformations. If None, defaults to False. |\n| `map_parallelization` | Whether to parallelize stateless map transformations. If None, defaults to False. |\n| `map_vectorization` | The map vectorization options associated with the dataset. See [`tf.data.experimental.MapVectorizationOptions`](../../../tf/data/experimental/MapVectorizationOptions) for more details. |\n| `noop_elimination` | Whether to eliminate no-op transformations. If None, defaults to True. |\n| `parallel_batch` | Whether to parallelize copying of batch elements. If None, defaults to False. |\n| `shuffle_and_repeat_fusion` | Whether to fuse shuffle and repeat transformations. If None, defaults to True. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__eq__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/data/util/options.py#L37-L43) \n\n __eq__(\n other\n )\n\nReturn self==value.\n\n### `__ne__`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/data/util/options.py#L45-L49) \n\n __ne__(\n other\n )\n\nReturn self!=value."]]