torch.linalg.det¶
-
torch.linalg.
det
(A, *, out=None) → Tensor¶ Computes the determinant of a square matrix.
Supports input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices, and if
A
is a batch of matrices then the output has the same batch dimensions.See also
torch.linalg.slogdet()
computes the sign (resp. angle) and natural logarithm of the absolute value (resp. modulus) of the determinant of real-valued (resp. complex) square matrices.- Parameters
A (Tensor) – tensor of shape (*, n, n) where * is zero or more batch dimensions.
- Keyword Arguments
out (Tensor, optional) – output tensor. Ignored if None. Default: None.
Examples:
>>> A = torch.randn(3, 3) >>> torch.linalg.det(A) tensor(0.0934) >>> A = torch.randn(3, 2, 2) >>> torch.linalg.det(A) tensor([1.1990, 0.4099, 0.7386])