PyTorch torch.matrix_exp function
PyTorch torch reference manual
torch.matrix_exp is a function in PyTorch used to compute the matrix exponential.
Function definition
torch.matrix_exp(input)
Usage examples
Example
import
torch
Create a square matrix
A
=
torch.
tensor
(
[
[
1.0
,
0.0
]
,
[
0.0
,
1.0
]
]
)
Compute the matrix exponential
exp_A
=
torch.
matrix_exp
(
A
)
(
"Matrix exponential:"
)
(
exp_A
)
The output is:
矩阵指数:
tensor([[2.7183, 0.0000],
[0.0000, 2.7183]])