<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/core.py#L800-L824) |

Gets the shape of the tensor input.

    tf.keras.ops.shape(
        x
    )

> [!NOTE]
> **Note:** On the TensorFlow backend, when `x` is a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with dynamic shape, dimensions which are dynamic in the context of a compiled function will have a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) value instead of a static integer value.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A tensor. This function will try to access the `shape` attribute of the input tensor. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tuple of integers or None values, indicating the shape of the input tensor. ||

<br />

#### Example:

    x = keras.ops.zeros((8, 12))
    keras.ops.shape(x)
    (8, 12)