# tf.compat.v1.disable_eager_execution

<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/framework/ops.py#L5631-L5649) |

Disables eager execution.

    tf.compat.v1.disable_eager_execution()

<br />

## Migrate to TF2

<br />

> [!CAUTION]
> **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.

This function is not necessary if you are using TF2. Eager execution is
enabled by default. If you want to use Graph mode please consider
[tf.function](https://www.tensorflow.org/api_docs/python/tf/function).

<br />

<br />

## Description

This function can only be called before any Graphs, Ops, or Tensors have been
created.