torch.atan2¶
- torch.atan2(input: Tensor, other: Tensor, *, out: Optional[Tensor]) Tensor ¶
逐元素計算 的反正切函數,並考慮象限。 回傳一個新的 tensor,包含向量 與向量 之間的有符號角度,以弧度表示。(請注意,,第二個參數,是 x 座標,而 ,第一個參數,是 y 座標。)
input
和other
的形狀必須是 可廣播的。- 參數
- 關鍵字參數
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])