mindspore.ops.erf
- mindspore.ops.erf(input)[source]
Computes the Gauss error function of input element-wise.
\[erf(x)=\frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt\]- Parameters
input (Tensor) –
The input tensor of Gaussian error function. \(x\) in the following formula. Supported dtypes:
Ascend: float16, float32, int64, bool.
GPU/CPU: float16, float32, float64.
- Returns
Tensor. If the input is int64 or bool, the return value type is float32. Otherwise, the return value type is the same as the input type.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> input = Tensor(np.array([-1, 0, 1, 2, 3]), mindspore.float32) >>> output = ops.erf(input) >>> print(output) [-0.8427168 0. 0.8427168 0.99530876 0.99997765]