torch.hypot¶ torch.hypot(input, other, *, out=None) → Tensor¶ 給定直角三角形的兩條直角邊長,返回其斜邊長。 outi=inputi2+otheri2\text{out}_{i} = \sqrt{\text{input}_{i}^{2} + \text{other}_{i}^{2}} outi=inputi2+otheri2input 和 other 的形狀必須是可廣播的。 引數 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])