TUTORIALAI 与数据科学FETCHED

PyTorch torch.arctan 函数

PyTorch torch.arctan 函数 Pytorch torch 参考手册 torch.arctan 是 PyTorch 中用于计算逐元素反正切(arctangent)的函数,与 torch.atan 功能相同。 函数定义 torch.arctan(input, out=None) 使用示例 实例 [mycode4 type='python'] import torch # 创建张量 ..

更新于 2026/7/16

教程详情页默认 noindex。

PyTorch torch.arctan 函数


Pytorch torch 参考手册 Pytorch torch 参考手册

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)

输出结果为:

tensor([-0.7854, -0.4636,  0.0000,  0.4636,  0.7854])

Pytorch torch 参考手册 Pytorch torch 参考手册