Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.nextafter function

PyTorch torch.nextafter function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual