tf.keras.ops.eye

Return a 2-D tensor with ones on the diagonal and zeros elsewhere.

NNumber of rows in the output.
MNumber of columns in the output. If None, defaults to N.
kIndex of the diagonal: 0 (the default) refers to the main diagonal, a positive value refers to an upper diagonal, and a negative value to a lower diagonal.
dtypeData type of the returned tensor.

Tensor with ones on the k-th diagonal and zeros elsewhere.