| torch_diag {torch} | R Documentation |
Diag
Description
Diag
Usage
torch_diag(self, diagonal = 0L)
Arguments
self |
(Tensor) the input tensor. |
diagonal |
(int, optional) the diagonal to consider |
diag(input, diagonal=0, out=NULL) -> Tensor
If
inputis a vector (1-D tensor), then returns a 2-D square tensor with the elements ofinputas the diagonal.If
inputis a matrix (2-D tensor), then returns a 1-D tensor with the diagonal elements ofinput.
The argument diagonal controls which diagonal to consider:
If
diagonal= 0, it is the main diagonal.If
diagonal> 0, it is above the main diagonal.If
diagonal< 0, it is below the main diagonal.
[Package torch version 0.13.0 Index]