# tf.data.experimental.get_structure

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/get_structure) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/data/ops/dataset_ops.py#L2518-L2537) |

Returns the type specification of an element of a `Dataset` or `Iterator`.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.data.experimental.get_structure(
        dataset_or_iterator
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dataset_or_iterator` | A [`tf.data.Dataset`](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/data/Dataset) or [`tf.data.Iterator`](https://www.tensorflow.org/api_docs/python/tf/data/Iterator). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A nested structure of [`tf.TypeSpec`](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/TypeSpec) objects matching the structure of an element of `dataset_or_iterator` and spacifying the type of individal components. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `dataset_or_iterator` is not a `Dataset` or `Iterator` object. |

<br />