PyTorch torch.org 関数
torch.orgは、PyTorch において QR 分解の結果から直交行列を抽出するための関数です。この関数は通常、torch.geqrfと組み合わせて使用し、QR 分解の結果から直交行列 Q を取得します。
関数定義
torch.org(A)
使用例
例
import torch
# 行列を作成します
A = torch.randn(3, 3)
# まず QR 分解 (geqrf) を実行します
Q, R = torch.geqrf(A)
# org を使用して QR 結果から直交行列を抽出します
Q_ortho = torch.org(A)
print("Q 行列:")
print(Q_ortho)
# 行列を作成します
A = torch.randn(3, 3)
# まず QR 分解 (geqrf) を実行します
Q, R = torch.geqrf(A)
# org を使用して QR 結果から直交行列を抽出します
Q_ortho = torch.org(A)
print("Q 行列:")
print(Q_ortho)
出力結果は次のとおりです:
tensor([[-0.1234, 0.5678, -0.8123],
[ 0.4567, -0.2345, 0.5678],
[ 0.7890, 0.6789, 0.1234]])
その他の拡張
Pytorch torch リファレンスマニュアル