fn

cosh

Tensor
cosh(input: Tensor)
source

Element-wise hyperbolic cosine.

Computes cosh(x)=(ex+ex)/2\cosh(x) = (e^{x} + e^{-x}) / 2 for each entry. Always 1\ge 1.

Parameters

inputTensor
Input tensor.

Returns

Tensor

Element-wise result with the same shape as input.

Notes

Mathematical definition:

outi=cosh(xi)=exi+exi2\text{out}_i = \cosh(x_i) = \frac{e^{x_i} + e^{-x_i}}{2}

Gradient: sinh(x)\sinh(x).

Examples

>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.cosh(x)
Tensor([...])