math_util¶
Math utils functions.
Module Contents¶
|
Computes tangent of x element-wise. |
|
Computes hyperbolic tangent of x element-wise. |
|
A unified tangent and inverse tangent function for different signs of curvatures. |
|
Computes inverse tangent of x element-wise. |
|
Computes inverse hyperbolic tangent of x element-wise. |
|
A unified hyperbolic tangent and inverse hyperbolic tangent function for different signs of curvatures. |
|
Computes cosine of x element-wise. |
|
Computes hyperbolic cosine of x element-wise. |
|
Computes inverse cosine of x element-wise. |
|
Computes inverse hyperbolic cosine of x element-wise. |
|
Computes sine of x element-wise. |
|
Computes hyperbolic sine of x element-wise. |
|
A unified sine and inverse sine function for different signs of curvatures. |
|
Computes inverse sine of x element-wise. |
|
Computes inverse hyperbolic sine of x element-wise. |
|
A unified hyperbolic sine and inverse hyperbolic sine function for different signs of curvatures. |
- Tan(x)¶
Computes tangent of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
A tensor. Has the same type as x.
- Tanh(x)¶
Computes hyperbolic tangent of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type as x.
- Return type:
A tensor
- TanC(x, c)¶
A unified tangent and inverse tangent function for different signs of curvatures.
This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.
First-order expansion is used in order to calculate gradients correctly when c is zero.
- Parameters:
x (tensor) – A tensor.
c (tensor) – Manifold curvature.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArTan(x)¶
Computes inverse tangent of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type as x.
- Return type:
A tensor
- ArTanh(x)¶
Computes inverse hyperbolic tangent of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type as x.
- Return type:
A tensor
- ArTanC(x, c)¶
A unified hyperbolic tangent and inverse hyperbolic tangent function for different signs of curvatures.
This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.
First-order expansion is used in order to calculate gradients correctly when c is zero.
- Parameters:
x (tensor) – A tensor.
c (tensor) – Manifold curvature.
- Returns:
Has the same type of x.
- Return type:
A tensor
- Cos(x)¶
Computes cosine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- Cosh(x)¶
Computes hyperbolic cosine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArCos(x)¶
Computes inverse cosine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArCosh(x)¶
Computes inverse hyperbolic cosine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- Sin(x)¶
Computes sine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- Sinh(x)¶
Computes hyperbolic sine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- SinC(x, c)¶
A unified sine and inverse sine function for different signs of curvatures.
This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.
First-order expansion is used in order to calculate gradients correctly when c is zero.
- Parameters:
x (tensor) – A tensor.
c (tensor) – Manifold curvature.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArSin(x)¶
Computes inverse sine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArSinh(x)¶
Computes inverse hyperbolic sine of x element-wise.
- Parameters:
x (tensor) – A tensor.
- Returns:
Has the same type of x.
- Return type:
A tensor
- ArSinC(x, c)¶
A unified hyperbolic sine and inverse hyperbolic sine function for different signs of curvatures.
This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.
First-order expansion is used in order to calculate gradients correctly when c is zero.
- Parameters:
x (tensor) – A tensor.
c (tensor) – Manifold curvature.
- Returns:
Has the same type of x.
- Return type:
A tensor