快捷方式

torch.atan2

torch.atan2(input: 张量, other: 张量, *, out: Optional[张量]) 张量

逐元素的反正切,计算 inputi/otheri\text{input}_{i} / \text{other}_{i} 并考虑象限。返回一个新张量,其中包含向量 (otheri,inputi)(\text{other}_{i}, \text{input}_{i}) 与向量 (1,0)(1, 0) 之间的带符号角度(以弧度为单位)。(请注意,第二个参数 otheri\text{other}_{i} 是 x 坐标,而第一个参数 inputi\text{input}_{i} 是 y 坐标。)

inputother 的形状必须是可广播的

参数
  • input (张量) – 第一个输入张量

  • other (张量) – 第二个输入张量

关键字参数

out (张量, 可选的) – 输出张量。

示例

>>> a = torch.randn(4)
>>> a
tensor([ 0.9041,  0.0196, -0.3108, -2.4423])
>>> torch.atan2(a, torch.randn(4))
tensor([ 0.9833,  0.0811, -1.9743, -1.4151])

文档

查阅 PyTorch 全面的开发者文档

查看文档

教程

获取面向初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得问题解答

查看资源