paddle.linalg. slogdet ( x, name=None ) [source]

Calculates the sign and natural logarithm of the absolute value of a square matrix’s or batches square matrices’ determinant. The determinant can be computed with sign * exp (logabsdet).

Supports input of float, double.

Note that for matrices that have zero determinant, this returns (0, -inf).

  • x (Tensor) – the batch of matrices of size \((*, n, n)\) where math:* is one or more batch dimensions.

  • name (str, optional) – Name of the output.It’s used to print debug info for developers. Details: Name. Default is None.


y (Tensor), A tensor containing the sign of the determinant and the natural logarithm of the absolute value of determinant, respectively.


>>> import paddle
>>> paddle.seed(2023)
>>> x = paddle.randn([3, 3, 3])
>>> A = paddle.linalg.slogdet(x)
>>> print(A)
Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[-1.        ,  1.        ,  1.        ],
 [ 0.25681755, -0.25061053, -0.10809582]])