<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/numpy.py#L6539-L6551) |

Return the number of dimensions of a tensor.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.ndim`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/ndim)

<br />

    tf.keras.ops.ndim(
        x
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The number of dimensions in `x`. ||

<br />