mindspore.ops.nextafter
- mindspore.ops.nextafter(input, other)[source]
Returns the next representable floating-point value after input towards other element-wise.
Say there are two float32 numbers
, , and let the representable delta of float32 datatype is . If , then the next representable of towards is , the next representable of towards is .For more detailed information, refer to A Self Regularized Non-Monotonic Neural Activation Function.
- Parameters
input (Tensor) – The first input tensor. The shape of tensor is
where means, any number of additional dimensions. Must be one of the following types: float32, float64.other (Tensor) – The second input tensor. The shape of tensor is
where means, any number of additional dimensions. Must be one of the following types: float32, float64.
- Returns
Tensor, has the same shape and data type as input.
- Raises
TypeError – If neither input nor other is a Tensor.
TypeError – If the dtype of input and other is not one of: float32, float64.
TypeError – If the dtypes of input and other are not same.
ValueError – If input's shape is not the same as other.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input_ = Tensor(np.asarray([0.0]), mindspore.float32) >>> other_ = Tensor(np.asarray([0.1]), mindspore.float32) >>> output_ = ops.nextafter(input_, other_) >>> print(output_) [1.e-45]