<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/framework/ops.py#L4863-L4893) |

Returns True if executing eagerly, even if inside a graph function.

    tf.compat.v1.executing_eagerly_outside_functions() -> bool

This function will check the outermost context for the program and see if
it is in eager mode. It is useful comparing to [`tf.executing_eagerly()`](https://www.tensorflow.org/api_docs/python/tf/executing_eagerly),
which checks the current context and will return `False` within a
[`tf.function`](https://www.tensorflow.org/api_docs/python/tf/function) body. It can be used to build library that behave differently
in eager runtime and v1 session runtime (deprecated).

#### Example:

    tf.compat.v1.enable_eager_execution()
    @tf.function
    def func():
      # A function constructs TensorFlow graphs, it does not execute eagerly,
      # but the outer most context is still eager.
      assert not tf.executing_eagerly()
      return tf.compat.v1.executing_eagerly_outside_functions()
    func()
    <tf.Tensor: shape=(), dtype=bool, numpy=True>

<br />

<br />

<br />

| ## Returns ||
|---|---|
| boolean, whether the outermost context is in eager mode. ||

<br />