eye(N, M=None, k=0, dtype=float64, device=None)¶
Returns a 2-D array with ones on the diagonals and zeros elsewhere.
N (int) – Number of rows.
M (int) – Number of columns. M == N by default.
k (int) – Index of the diagonal. Zero indicates the main diagonal, a positive index an upper diagonal, and a negative index a lower diagonal.
dtype – Data type.
A 2-D array with given diagonals filled with ones and zeros elsewhere.
- Return type