PyTorch torch.nextafter Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.nextafteris a function in PyTorch used to return the next representable floating-point number element-wise.

Function Definition

torch.nextafter(input, other, out=None)

Usage Example

Example

import torch

# Returns the next representable floating-point number
x = torch.tensor([1.0, 2.0])
y = torch.tensor([2.0, 2.0])
result = torch.nextafter(x, y)
print(result)

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions