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

PyTorch torch.matrix_exp function

PyTorch torch.matrix_exp function


PyTorch torch reference manual 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

)

print

(

"Matrix exponential:"

)

print

(

exp_A

)

The output is:

矩阵指数:

tensor([[2.7183, 0.0000],

        [0.0000, 2.7183]])


PyTorch torch reference manual PyTorch torch reference manual