快捷方式

torch.hypot

torch.hypot(input, other, *, out=None) Tensor

給定直角三角形的兩條直角邊長,返回其斜邊長。

outi=inputi2+otheri2\text{out}_{i} = \sqrt{\text{input}_{i}^{2} + \text{other}_{i}^{2}}

inputother 的形狀必須是可廣播的

引數
  • input (Tensor) – 第一個輸入張量

  • other (Tensor) – 第二個輸入張量

關鍵字引數

out (Tensor, 可選) – 輸出張量。

示例

>>> a = torch.hypot(torch.tensor([4.0]), torch.tensor([3.0, 4.0, 5.0]))
tensor([5.0000, 5.6569, 6.4031])

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

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

檢視資源