# tf.control_flow_v2_enabled

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/control_flow_v2_toggles.py#L61-L67) |

Returns `True` if v2 control flow is enabled.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.control_flow_v2_enabled()

> [!NOTE]
> **Note:** v2 control flow is always enabled inside of tf.function.