PyTorch torch.nextafter function
PyTorch torch reference manual
torch.nextafter is a function in PyTorch used to return the next representable floating-point value, element by element.
Function definition
torch.nextafter(input, other, out=None)
Usage examples
Example
import
torch
Return the next representable floating-point value
x
=
torch.
tensor
(
[
1.0
,
2.0
]
)
y
=
torch.
tensor
(
[
2.0
,
2.0
]
)
result
=
torch.
nextafter
(
x
,
y
)
(
result
)