API

 torch / torch


torch.nextafter

torch.nextafter(input, other, *, out=None) → Tensor

Return the next floating-point value after input towards other, elementwise.

The shapes of input and other must be broadcastable.

Parameters
  • input (Tensor) – the first input tensor

  • other (Tensor) – the second input tensor

Keyword Arguments

out (Tensor, optional) – the output tensor.

Example::
>>> eps = torch.finfo(torch.float32).eps
>>> torch.nextafter(torch.Tensor([1, 2]), torch.Tensor([2, 1])) == torch.Tensor([eps + 1, 2 - eps])
tensor([True, True])

此页内容是否对您有帮助