torch_trace: Trace

View source: R/gen-namespace.R

torch_traceR Documentation

Trace

Description

Trace

Usage

torch_trace(self)

Arguments

self

the input tensor

trace(input) -> Tensor

Returns the sum of the elements of the diagonal of the input 2-D matrix.

Examples

if (torch_is_installed()) {

x <- torch_arange(1, 9)$view(c(3, 3))
x
torch_trace(x)
}

torch documentation built on June 7, 2023, 6:19 p.m.