nextafter

paddle. nextafter ( x, y, name=None ) [source]

Return the next floating-point value after input towards other, elementwise. The shapes of input and other must be broadcastable.

Parameters
  • x (Tensor) – An N-D Tensor, the data type is float32, float64.

  • y (Tensor) – An N-D Tensor, the data type is float32, float64.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

An N-D Tensor, the shape and data type is the same with input.

Return type

out (Tensor)

Examples

>>> import paddle
>>> out = paddle.nextafter(paddle.to_tensor([1.0,2.0]),paddle.to_tensor([2.0,1.0]))
>>> out
Tensor(shape=[2], dtype=float32, place=Place(cpu), stop_gradient=True,
[1.00000012, 1.99999988])