# tf.data.experimental.OptimizationOptions

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/data/ops/options.py#L304-L463) |

Represents options for dataset optimizations.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.data.experimental.OptimizationOptions`](https://www.tensorflow.org/api_docs/python/tf/data/experimental/OptimizationOptions)

<br />

    tf.data.experimental.OptimizationOptions()

You can set the optimization options of a dataset through the
`experimental_optimization` property of [`tf.data.Options`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data/Options); the property is
an instance of [`tf.data.experimental.OptimizationOptions`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data/experimental/OptimizationOptions).

    options = tf.data.Options()
    options.experimental_optimization.noop_elimination = True
    options.experimental_optimization.apply_default_optimizations = False
    dataset = dataset.with_options(options)

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `apply_default_optimizations` | Whether to apply default graph optimizations. If False, only graph optimizations that have been explicitly enabled will be applied. |
| `filter_fusion` | Whether to fuse filter transformations. If None, defaults to False. |
| `filter_parallelization` | Whether to parallelize stateless filter transformations. If None, defaults to False. |
| `inject_prefetch` | Whether to inject prefetch transformation as the last transformation when the last transformation is a synchronous transformation. If None, defaults to True. |
| `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 True. |
| `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 True. |
| `shuffle_and_repeat_fusion` | Whether to fuse shuffle and repeat transformations. If None, defaults to True. |
| `warm_start` | Whether to start background threads of asynchronous transformations upon iterator creation (as opposed to upon first call to `GetNext`). If None, defaults to False. It should be noted that this possibly improves the latency of the initial 'GetNext' call at the expense of requiring more memory to hold prefetched elements between the time of iterator construction and usage. |

<br />

## Methods

### `__eq__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/data/util/options.py#L38-L44)

    __eq__(
        other
    )

Return self==value.

### `__ne__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/data/util/options.py#L46-L50)

    __ne__(
        other
    )

Return self!=value.