• 文档 >
  • torch >
  • torch.hypot
快捷键

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 的形状必须可广播。

参数:
  • 输入(张量)- 第一个输入张量

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

关键字参数:

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

示例:

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

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源