<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#L2678-L2694) |

Create a two-dimensional array with the flattened input on the k-th diagonal.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.diagflat(
        x, k=0
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor to be flattened and placed on the diagonal. |
| `k` | The diagonal to place the flattened input. Defaults to `0`. Use `k > 0` for diagonals above the main diagonal, and `k < 0` for diagonals below the main diagonal. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A 2-D tensor with the flattened input on the specified diagonal. ||

<br />