torch_diag(self, diagonal = 0L)
(Tensor) the input tensor.
(int, optional) the diagonal to consider
input is a vector (1-D tensor), then returns a 2-D square tensor
with the elements of
input as the diagonal.
input is a matrix (2-D tensor), then returns a 1-D tensor with
the diagonal elements of
diagonal controls which diagonal to consider:
diagonal = 0, it is the main diagonal.
diagonal > 0, it is above the main diagonal.
diagonal < 0, it is below the main diagonal.