lab.trace(x)
y=lab.trace(x) returns the trace (sum of the diagonal elements) of a matrix x. This is equal to the sum of the eigenvalues of x. The returned value y is a number, not a tensor.
y=lab.trace(x)
y