PyTorch torch.arccos 関数
Pytorch torch リファレンスマニュアルPytorch torch リファレンスマニュアル
torch.arccosは PyTorch で要素ごとの逆余弦(arccosine)を計算する関数で、torch.acos機能は同じです。
関数定義
torch.arccos(input, out=None)
使用例
実例
import torch
# テンソルを作成
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# 逆余弦を計算
result = torch.arccos(x)
print(result)
# テンソルを作成
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# 逆余弦を計算
result = torch.arccos(x)
print(result)
出力結果は次のとおりです:
tensor([3.1416, 2.0944, 1.5708, 1.0472, 0.0000])
その他の拡張