mindspore.mint.cosh

View Source On Gitee
mindspore.mint.cosh(input)[source]

Computes hyperbolic cosine of input element-wise.

\[out_i = \cosh(input_i)\]
Parameters

input (Tensor) –

The input tensor of hyperbolic cosine function. Supported dtypes:

  • Ascend: bool, int8, uint8, int16, int32, int64, float16, float32, float64, complex64, complex128 or bfloat16.

Returns

Tensor, has the same shape as input.

Raises
  • TypeError – If input is not a Tensor.

  • TypeError

    • Ascend: If dtype of input is not bool, int8, uint8, int16, int32, int64, float16, float32, float64, complex64, complex128 or bfloat16.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, mint
>>> x = Tensor(np.array([0.24, 0.83, 0.31, 0.09]), mindspore.float32)
>>> output = mint.cosh(x)
>>> print(output)
[1.0289385 1.364684 1.048436 1.0040528]
>>> x = Tensor(2.1, mindspore.float32)
>>> output = mint.cosh(x)
>>> print(output)
4.144313