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

torch.nextafter

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

按元素方式返回 input 之后相对于 other 的下一个浮点数值。

inputother 的形状必须可广播。

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

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

关键字参数:

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

示例:

>>> eps = torch.finfo(torch.float32).eps
>>> torch.nextafter(torch.tensor([1.0, 2.0]), torch.tensor([2.0, 1.0])) == torch.tensor([eps + 1, 2 - eps])
tensor([True, True])

© 版权所有 PyTorch 贡献者。

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

文档

PyTorch 的全面开发者文档

查看文档

教程

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

查看教程

资源

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

查看资源