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. Its data type must be float16 float32 or float64.

Returns

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

Raises
  • TypeError – If input is not a Tensor.

  • TypeError – If dtype of input is neither float16 float32 or float64.

Supported Platforms:

Ascend GPU CPU

Examples

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