PyTorch torch.arcsin 函数

约 322 字 更新于 2026-11-18 5iyo.com

PyTorch torch.arcsin 函数


torch.arcsin 是 PyTorch 中用于计算逐元素反正弦(arcsine)的函数,与 torch.asin 功能相同。

函数定义

torch.arcsin(input, out=None)

使用示例

实例

import torch

# 创建张量
x = torch.tensor([-1.0, -0.5, 0.0, 0.5, 1.0])

# 计算反正弦
result = torch.arcsin(x)
print(result)

输出结果为:

tensor([-1.5708, -0.5236,  0.0000,  0.5236,  1.5708])