TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.linalg.diagonal

tensorplay.linalg.diagonal()

linalg_diagonal(A, *, offset=0, dim1=-2, dim2=-1) -> Tensor

Returns a view of the diagonals of A: the two dimensions selected by dim1 and dim2 are collapsed into the trailing axis of the output, holding the entries of the diagonal shifted by offset (positive shifts above, negative below the main diagonal).

See tensorplay.diagonal()

On this page

Ask DeepWiki