mindspore.ops.NextAfter
- class mindspore.ops.NextAfter[源代码]
逐元素返回 x1 指向 x2 的下一个可表示值符点值。
比如有两个数
, ,数据类型为float32。并且设float32数据类型的可表示值增量为 。如果 ,那么 指向 的下一个可表示值就是 , 指向 的下一个可表示值就是 。更多详细信息请参见 A Self Regularized Non-Monotonic Neural Activation Function 。
- 输入:
x1 (Tensor) - 支持数据类型为float32和float64。其shape为
,其中 为任意数量的额外维度。x2 (Tensor) - 支持数据类型为float32和float64。其shape为
,其中 为任意数量的额外维度。
- 输出:
Tensor,shape和数据类型与 x1 相同。
- 异常:
TypeError - x1 和 x2 都不是Tensor。
TypeError - x1 和 x2 的数据类型非float16或float32。
TypeError - x1 和 x2 数据类型不一致。
ValueError - x1 和 x2 的shape不一致。
- 支持平台:
GPU
CPU
样例:
>>> nextafter = ops.NextAfter() >>> x1 = Tensor(np.asarray([0.0]), mindspore.float32) >>> x2 = Tensor(np.asarray([0.1]), mindspore.float32) >>> output = nextafter(x1, x2) >>> print(output) [1.e-45]