PyTorch torch.logdet Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.logdetis a function in PyTorch used to compute the logarithm of the determinant of a matrix.

Function Definition

torch.logdet(input)

Usage Example

Example

import torch

# Create a square matrix
A = torch.tensor([[2.0, 1.0], [1.0, 3.0]])

# Compute the logarithm of the determinant
log_det = torch.logdet(A)
print("Log of determinant:", log_det)

The output result is:

行列式对数: tensor(1.6094)

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions