PyTorch torch.atanh 函数
torch.atanh 是 PyTorch 中用于计算逐元素反双曲正切(inverse hyperbolic tangent)的函数。
函数定义
torch.atanh(input, out=None)
使用示例
实例
import torch
# 创建张量(值必须在-1到1之间)
x = torch.tensor([-0.5, -0.25, 0.0, 0.25, 0.5])
# 计算反双曲正切
result = torch.atanh(x)
print(result)
# 创建张量(值必须在-1到1之间)
x = torch.tensor([-0.5, -0.25, 0.0, 0.25, 0.5])
# 计算反双曲正切
result = torch.atanh(x)
print(result)
输出结果为:
tensor([-0.5493, -0.2554, 0.0000, 0.2554, 0.5493])

Pytorch torch 参考手册