Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.logdet function

PyTorch torch.logdet function


PyTorch torch reference manual PyTorch torch reference manual

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

Function definition

torch.logdet(input)


Usage examples

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 determinant:"

,

log_det

)

The output is:

行列式对数: tensor(1.6094)


PyTorch torch reference manual PyTorch torch reference manual