PyTorch torch.matrix_exp Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.matrix_expis a function in PyTorch used to compute the matrix exponential.

Function Definition

torch.matrix_exp(input)

Usage Example

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 result is:

矩阵指数:
tensor([[2.7183, 0.0000],
        [0.0000, 2.7183]])

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions