mindspore.ops.nextafter

View Source On Gitee
mindspore.ops.nextafter(input, other)[source]

Returns the next representable floating-point value after input towards other element-wise.

outi={inputi+eps,if inputi<otheriinputieps,if inputi>otheriinputi,if inputi=otheri

Where eps is the smallest representable increment value for the input tensor's dtype.

For more detailed information, refer to A Self Regularized Non-Monotonic Neural Activation Function.

Parameters
  • input (Tensor) – The first input tensor.

  • other (Tensor) – The second input tensor.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([0.0], mindspore.float32)
>>> other = mindspore.tensor([0.1], mindspore.float32)
>>> output = mindspore.ops.nextafter(input, other)
>>> print(output)
[1.e-45]