# tf.group

<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/ops/control_flow_ops.py#L1977-L2053) |

Create an op that groups multiple operations.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.group(
        *inputs, **kwargs
    )

When this op finishes, all ops in `inputs` have finished. This op has no
output.

> [!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.group`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/group) when working with v1 [`tf.Graph`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/Graph) code.

When operating in a v1-style graph context, ops are not executed in the same
order as specified in the code; TensorFlow will attempt to execute ops in
parallel or in an order convenient to the result it is computing. [`tf.group`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/group)
allows you to request that one or more results finish before execution
continues.

[`tf.group`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/group) creates a single op (of type `NoOp`), and then adds appropriate
control dependencies. Thus, `c = tf.group(a, b)` will compute the same graph
as this:

    with tf.control_dependencies([a, b]):
        c = tf.no_op()

See also [`tf.tuple`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/tuple) and
[`tf.control_dependencies`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/control_dependencies).

<br />

<br />

<br />

| ## Args ||
|---|---|
| `*inputs` | Zero or more tensors to group. |
| `name` | A name for this operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An Operation that executes all its inputs. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If an unknown keyword argument is provided. |

<br />