megengine.functional.asin¶
- asin(x)[source]¶
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)\).
- Parameters
x – input tensor. Should have a floating-point data type.
- Returns
a tensor containing the inverse sine of each element in \(x\). The returned tensor must have a floating-point data type determined by Type promotion rules.
Special cases
For floating-point operands,
If \(x_i\) is
NaN
, the result isNaN
.If \(x_i\) is greater than
1
, the result isNaN
.If \(x_i\) is less than
-1
, the result isNaN
.If \(x_i\) is
+0
, the result is+0
.If \(x_i\) is
-0
, the result is-0
.
Examples
>>> 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)