torch.det

torch.det(input) → Tensor

Calculates determinant of a square matrix or batches of square matrices.

Note

torch.det() is deprecated. Please use torch.linalg.det() instead.

Note

Backward through detdet internally uses SVD results when input is not invertible. In this case, double backward through detdet will be unstable when input doesn’t have distinct singular values. See torch.svd~torch.svd for details.

Parameters

input (Tensor) – the input tensor of size (*, n, n) where * is zero or more batch dimensions.

Example:

>>> A = torch.randn(3, 3)
>>> torch.det(A)
tensor(3.7641)

>>> A = torch.randn(3, 2, 2)
>>> A
tensor([[[ 0.9254, -0.6213],
         [-0.5787,  1.6843]],

        [[ 0.3242, -0.9665],
         [ 0.4539, -0.0887]],

        [[ 1.1336, -0.4025],
         [-0.7089,  0.9032]]])
>>> A.det()
tensor([1.1990, 0.4099, 0.7386])

© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.det.html