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])