PyTorch torch.matrix_exp 関数
torch.matrix_expは PyTorch で行列指数を計算するための関数です。
関数定義
torch.matrix_exp(input)
使用例
例
import torch
# 正方行列を作成
A = torch.tensor([[1.0, 0.0], [0.0, 1.0]])
# 行列指数を計算
exp_A = torch.matrix_exp(A)
print("行列指数:")
print(exp_A)
# 正方行列を作成
A = torch.tensor([[1.0, 0.0], [0.0, 1.0]])
# 行列指数を計算
exp_A = torch.matrix_exp(A)
print("行列指数:")
print(exp_A)
出力結果は次のとおりです:
矩阵指数:
tensor([[2.7183, 0.0000],
[0.0000, 2.7183]])
その他の拡張
Pytorch torch リファレンスマニュアル