# tf.compat.v1.data.get_output_shapes

<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#L4384-L4403) |

Returns the output shapes for elements of the input dataset / iterator.

    tf.compat.v1.data.get_output_shapes(
        dataset_or_iterator
    )

<br />

## Migrate to TF2

<br />

> [!CAUTION]
> **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.

This is a legacy API for inspecting the type signature of dataset elements. In
TF 2, you should use the [`tf.data.Dataset.element_spec`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/data/Dataset#element_spec) attribute instead.

<br />

<br />

## Description

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A (nested) structure of [`tf.TensorShape`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/TensorShape) objects matching the structure of the dataset / iterator elements and specifying the shape of the individual components. ||

<br />