快捷鍵

torch.atan2

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

逐元素計算 inputi/otheri\text{input}_{i} / \text{other}_{i} 的反正切函數,並考慮象限。 回傳一個新的 tensor,包含向量 (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) – 第一個輸入 tensor

  • other (Tensor) – 第二個輸入 tensor

關鍵字參數

out (Tensor, optional) – 輸出 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 的完整開發者文件

檢視文件

教學

取得針對初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得問題解答

檢視資源