mindspore.ops.Erf

class mindspore.ops.Erf(*args, **kwargs)[source]

Computes the Gauss error function of input_x element-wise.

\[erf(x)=\frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt\]
Inputs:
  • input_x (Tensor) - The input tensor. The data type must be float16 or float32.

Outputs:

Tensor, has the same shape and dtype as the input_x.

Raises

TypeError – If dtype of input_x is neither float16 nor float32.

Supported Platforms:

Ascend

Examples

>>> input_x = Tensor(np.array([-1, 0, 1, 2, 3]), mindspore.float32)
>>> erf = ops.Erf()
>>> output = erf(input_x)
>>> print(output)
[-0.8427168   0.          0.8427168   0.99530876  0.99997765]