# tf.data.experimental.from_variant

<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/data/ops/dataset_ops.py#L4486-L4498) |

Constructs a dataset from the given variant and (nested) structure.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.data.experimental.from_variant(
        variant, structure
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `variant` | A scalar [`tf.variant`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf#variant) tensor representing a dataset. |
| `structure` | A (nested) structure of [`tf.TypeSpec`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/TypeSpec) objects representing the structure of each element in the dataset. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.data.Dataset`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data/Dataset) instance. ||

<br />