# megengine.functional.asin¶

asin(x)[源代码]

Element-wise $$\arcsin(x)$$ function.

Calculates an approximation to the inverse sine for each element $$x_i$$ of the input tensor $$x$$. Each element-wise result is expressed in radians.

This function has domain [-1, +1] and codomain [-pi/2, pi/2].

The inverse of $$\sin$$ so that, if $$y = \sin(x)$$, then $$x = \arcsin(y)$$.

x – input tensor. Should have a floating-point data type.

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

Special cases

For floating-point operands,

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

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

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

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

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

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


Element-wise inverse sine:

>>> x = Tensor([0, 1, -1])
>>> F.asin(x)
Tensor([ 0.      1.5708 -1.5708], device=xpux:0)