mindspore.mint.erf

查看源文件
mindspore.mint.erf(input)[源代码]

逐元素计算输入tensor的高斯误差。

\[\text{erf}(x)=\frac{2} {\sqrt{\pi}} \int\limits_0^{x} e^{-t^{2}} dt\]
参数:
  • input (Tensor) - 输入tensor。

返回:

Tensor

支持平台:

Ascend

样例:

>>> import mindspore
>>> # The datatype of output will be float32 when datatype of input is in [int64, bool](Datatype only supported on Ascend).
>>> input = mindspore.tensor([-1, 0, 1, 2, 3], mindspore.int64)
>>> mindspore.mint.erf(input)
Tensor(shape=[5], dtype=Float32, value= [-8.42700793e-01,  0.00000000e+00,  8.42700793e-01,  9.95322265e-01,  9.99977910e-01])
>>>
>>> # Otherwise output has the same dtype as the input.
>>> input = mindspore.tensor([-1, 0, 1, 2, 3], mindspore.float64)
>>> mindspore.mint.erf(input)
Tensor(shape=[5], dtype=Float64, value= [-8.42700793e-01,  0.00000000e+00,  8.42700793e-01,  9.95322265e-01,  9.99977910e-01])