torch.nextafter¶
- torch.nextafter(input, other, *, out=None) Tensor ¶
按元素方式返回
input
之后相对于other
的下一个浮点数值。input
和other
的形状必须可广播。- 参数:
输入(张量)- 第一个输入张量
其他(张量)- 第二个输入张量
- 关键字参数:
输出(张量,可选)- 输出张量。
示例:
>>> 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])