Rate this Page

torch.cosh#

torch.cosh(input,*,out=None)Tensor#

Returns a new tensor with the hyperbolic cosine of the elements ofinput.

outi=cosh(inputi)\text{out}_{i} = \cosh(\text{input}_{i})
Parameters

input (Tensor) – the input tensor.

Keyword Arguments

out (Tensor,optional) – the output tensor.

Example:

>>>a=torch.randn(4)>>>atensor([ 0.1632,  1.1835, -0.6979, -0.7325])>>>torch.cosh(a)tensor([ 1.0133,  1.7860,  1.2536,  1.2805])

Note

Wheninput is on the CPU, the implementation of torch.cosh may usethe Sleef library, which rounds very large results to infinity or negativeinfinity. Seehere for details.