# megengine.functional.atanh¶

atanh(x)[源代码]

Element-wise $$\tanh^{-1}(x)$$ function.

Calculates the inverse hyperbolic tangent for each element $$x_i$$ of the input tensor $$x$$.

This function has domain [-1, +1] and codomain [-infinity, +infinity].

Special cases

• If $$x_i$$ is NaN, the result is NaN.

• If $$x_i$$ is less than -1, the result is NaN.

• If $$x_i$$ is greater than 1, the result is Nan.

• If $$x_i$$ is +1, the result is +infinity.

• If $$x_i$$ is -1, the result is -infinity.

• If $$x_i$$ is +0, the result is +0.

• If $$x_i$$ is -0, the result is -0.

x – input tensor whose elements each represent the area of a hyperbolic sector. Should have a floating-point data type.

a tensor containing the inverse hyperbolic tangent of each element in $$x$$. The returned tensor must have a floating-point data type determined by 类型提升规则.

>>> F.atanh(0)
Tensor(0.0, device=xpux:0)


Element-wise inverse hyperbolic tangent:

>>> x = Tensor([0, 0.5, -0.5])
>>> F.atanh(x)
Tensor([ 0.      0.5493 -0.5493], device=xpux:0)