torch.nextafter
-
torch.nextafter(input, other, *, out=None) → Tensor -
Возвращает следующее значение с плавающей точкой после
inputв направленииotherпоэлементно.Формы
inputиotherдолжны быть совместимы для широковещательной передачи.- Параметры:
- Именованные аргументы:
-
out (Tensor, необязательно) – выходной тензор.
Пример:
>>> 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])
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.nextafter.html