# tf.control_dependencies

<br />

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

Wrapper for [`Graph.control_dependencies()`](https://www.tensorflow.org/versions/r2.10/api_docs/python/tf/Graph#control_dependencies) using the default graph.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.control_dependencies(
        control_inputs
    )

See [`tf.Graph.control_dependencies`](https://www.tensorflow.org/versions/r2.10/api_docs/python/tf/Graph#control_dependencies) for more details.

> [!NOTE]
> **Note:** *In TensorFlow 2 with eager and/or Autograph, you should not require
> this method, as ops execute in the expected order thanks to automatic control
> dependencies.* Only use [`tf.control_dependencies`](https://www.tensorflow.org/versions/r2.10/api_docs/python/tf/control_dependencies) when working with v1 [`tf.Graph`](https://www.tensorflow.org/versions/r2.10/api_docs/python/tf/Graph) code.

When eager execution is enabled, any callable object in the `control_inputs`
list will be called.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `control_inputs` | A list of `Operation` or `Tensor` objects which must be executed or computed before running the operations defined in the context. Can also be `None` to clear the control dependencies. If eager execution is enabled, any callable object in the `control_inputs` list will be called. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A context manager that specifies control dependencies for all operations constructed within the context. ||

<br />