mindspore.ops.logdet

mindspore.ops.logdet(input)[source]

Calculates log determinant of one or a batch of square matrices.

Parameters

input (Tensor) – Tensor of shape \((*, n, n)\) where \(*\) means zero or more batch dimensions.

Returns

Tensor, the log determinant of input. If the matrix determinant is smaller than 0, nan will be returned. If the matrix determinant is 0, -inf will be returned.

Raises

TypeError – If dtype of input is not float32, float64, Complex64 or Complex128.

Supported Platforms:

CPU

Examples

>>> import mindspore
>>> from mindspore import Tensor, ops
>>> a = Tensor([[[8, 9], [1, 2]], [[5, 6], [3, 4]]], mindspore.float32)
>>> output = ops.logdet(a)
>>> print(output)
[1.9459091 0.6931454]