mindspore.ops.nextafter

查看源文件
mindspore.ops.nextafter(input, other)[源代码]

逐元素计算 input 指向 other 的下一个可表示浮点值。

\[\begin{split}out_i = \begin{cases} & input_i + eps, & \text{if } input_i < other_i \\ & input_i - eps, & \text{if } input_i > other_i \\ & input_i, & \text{if } input_i = other_i \end{cases}\end{split}\]

其中eps为输入tensor数据类型最小可表示增量值。

更多详细信息请参见 A Self Regularized Non-Monotonic Neural Activation Function

参数:
  • input (Tensor) - 第一个输入tensor

  • other (Tensor) - 第二个输入tensor。

返回:

Tensor

支持平台:

Ascend GPU CPU

样例:

>>> 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]