# tf.data.experimental.from_variant

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/data/experimental/from_variant) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/data/ops/dataset_ops.py#L2450-L2462) |

Constructs a dataset from the given variant and 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), \`tf.compat.v2.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/r1.15/api_docs/python/tf#variant) tensor representing a dataset. |
| `structure` | A [`tf.data.experimental.Structure`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/TypeSpec) object representing the structure of each element in the dataset. |

<br />

<br />

<br />

<br />

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

<br />