# tf.tuple

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/tuple) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/control_flow_ops.py#L2911-L2944) |

Group tensors together.

    tf.tuple(
        tensors, control_inputs=None, name=None
    )

This creates a tuple of tensors with the same values as the `tensors`
argument, except that the value of each tensor is only returned after the
values of all tensors have been computed.

`control_inputs` contains additional ops that have to finish before this op
finishes, but whose outputs are not returned.

This can be used as a "join" mechanism for parallel computations: all the
argument tensors can be computed in parallel, but the values of any tensor
returned by `tuple` are only available after all the parallel computations
are done.

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensors` | A list of `Tensor`s or `IndexedSlices`, some entries can be `None`. |
| `control_inputs` | List of additional ops to finish before returning. |
| `name` | (optional) A name to use as a `name_scope` for the operation. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Same as `tensors`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `tensors` does not contain any `Tensor` or `IndexedSlices`. |
| `TypeError` | If `control_inputs` is not a list of `Operation` or `Tensor` objects. |

<br />