<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#L8214-L8230) |

Return a tensor with ones at and below a diagonal and zeros elsewhere.

#### View aliases


**Main aliases**

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

<br />

    tf.keras.ops.tri(
        N, M=None, k=0, dtype=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `N` | Number of rows in the tensor. |
| `M` | Number of columns in the tensor. |
| `k` | The sub-diagonal at and below which the array is filled. `k = 0` is the main diagonal, while `k < 0` is below it, and `k > 0` is above. The default is 0. |
| `dtype` | Data type of the returned tensor. The default is "float32". |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Tensor with its lower triangle filled with ones and zeros elsewhere. `T[i, j] == 1` for `j <= i + k`, 0 otherwise. ||

<br />