PyTorch torch.arctanh 関数
torch.arctanhは、PyTorch で要素ごとの逆双曲線正接(inverse hyperbolic tangent)を計算する関数であり、torch.atanh機能は同じです。
関数定義
torch.arctanh(input, out=None)
使用例
実例
import torch
# テンソルを作成(値は -1 から 1 の間である必要があります)
x = torch.tensor([-0.5, -0.25, 0.0, 0.25, 0.5])
# 逆双曲線正接を計算
result = torch.arctanh(x)
print(result)
# テンソルを作成(値は -1 から 1 の間である必要があります)
x = torch.tensor([-0.5, -0.25, 0.0, 0.25, 0.5])
# 逆双曲線正接を計算
result = torch.arctanh(x)
print(result)
出力結果は次のとおりです:
tensor([-0.5493, -0.2554, 0.0000, 0.2554, 0.5493])
その他の拡張
Pytorch torch リファレンスマニュアル