<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#L5265-L5282) |

Compute the median along the specified axis.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.median(
        x, axis=None, keepdims=False
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `axis` | Axis or axes along which the medians are computed. Defaults to `axis=None` which is to compute the median(s) along a flattened version of the array. |
| `keepdims` | If this is set to `True`, the axes which are reduce are left in the result as dimensions with size one. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The output tensor. ||

<br />