torch_diagflat {torch}R Documentation

Diagflat

Description

Diagflat

Usage

torch_diagflat(self, offset = 0L)

Arguments

self

(Tensor) the input tensor.

offset

(int, optional) the diagonal to consider. Default: 0 (main diagonal).

diagflat(input, offset=0) -> Tensor

The argument offset controls which diagonal to consider:

Examples

if (torch_is_installed()) {

a = torch_randn(c(3))
a
torch_diagflat(a)
torch_diagflat(a, 1)
a = torch_randn(c(2, 2))
a
torch_diagflat(a)
}

[Package torch version 0.13.0 Index]