Shortcuts

torch.nextafter

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

返回 input 之后朝向 other 的下一个浮点值,逐元素操作。

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

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

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

Keyword Arguments

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

示例:

>>> 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])
优云智算