快捷方式

torch.atan2

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

逐元素计算 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 (Tensor) – 第一个输入张量

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

关键字参数

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

示例

>>> 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 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源