megengine.functional.sinh#

sinh(x)[source]#

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

Calculates the hyperbolic sine for each element \(x_i\) of the input tensor \(x\).

Equivalent to:

\[\frac {e^{x}-e^{-x}} {2}\]

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

Parameters:

x – input tensor whose elements each represent a hyperbolic angle. Should have a floating-point data type.

Returns:

a tensor containing the hyperbolic sine of each element in \(x\).

Special cases

For floating-point operands,

  • If \(x_i\) is NaN, the result is NaN.

  • If \(x_i\) is +0, the result is +0.

  • If \(x_i\) is -0, the result is -0.

  • If \(x_i\) is +infinity, the result is +infinity.

  • If \(x_i\) is -infinity, the result is +infinity.

Examples

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

Element-wise hyperbolic sine:

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