快捷方式

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 全面的開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源