Shortcuts

torch.hypot

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

给定一个直角三角形的两条直角边,返回其斜边。

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

The shapes of input and other must be 可广播的.

Parameters
  • 输入 (张量) – 第一个输入张量

  • 其他 (Tensor) – 第二个输入张量

Keyword Arguments

输出 (张量, 可选) – 输出张量。

示例:

>>> a = torch.hypot(torch.tensor([4.0]), torch.tensor([3.0, 4.0, 5.0]))
张量([5.0000, 5.6569, 6.4031])
优云智算