PyTorch torch.arctan 函数
torch.arctan 是 PyTorch 中用于计算逐元素反正切(arctangent)的函数,与 torch.atan 功能相同。
函数定义
torch.arctan(input, out=None)
使用示例
实例
import torch
# 创建张量
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# 计算反正切
result = torch.arctan(x)
print(result)
# 创建张量
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])
# 计算反正切
result = torch.arctan(x)
print(result)
输出结果为:
tensor([-0.7854, -0.4636, 0.0000, 0.4636, 0.7854])

Pytorch torch 参考手册