Element-wise \(\arccos(x)\) function.

Calculates an approximation to the inverse cosine 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 [0, pi].

The inverse of \(\cos\) so that, if \(y = \cos(x)\), then \(x = \arccos(y)\).


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


a tensor containing the inverse cosine 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 1, the result is +0.


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

Element-wise inverse cosine:

>>> import math
>>> x = Tensor([0, 1, -1])
>>> F.acos(x)
Tensor([1.5708 0.     3.1416], device=xpux:0)