<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#L7868-L7882) |

Interchange two axes of a tensor.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.swapaxes(
        x, axis1, axis2
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `axis1` | First axis. |
| `axis2` | Second axis. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor with the axes swapped. ||

<br />