📜  Python – tensorflow.raw_ops.Cosh()(1)

📅  最后修改于: 2023-12-03 15:34:07.033000             🧑  作者: Mango

Python - tensorflow.raw_ops.Cosh()

The tensorflow.raw_ops.Cosh() function returns the hyperbolic cosine of the given input tensor element-wise.

Syntax
tensorflow.raw_ops.Cosh(x, name=None)
Parameter
  • x: A Tensor. Must be one of the following types: half, float32, float64, complex64, complex128.

  • name (optional): A name for the operation (string).

Return Value

A Tensor. Has the same type as x.

Example
import tensorflow as tf

x = tf.constant([0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
output = tf.raw_ops.Cosh(x)

print(output)

Output:

tf.Tensor([1.         1.5430806  3.7621953  10.067661   27.308233   74.20995  ], shape=(6,), dtype=float32)
Explanation

The tensorflow.raw_ops.Cosh() function returns the hyperbolic cosine of the given input tensor element-wise.

The hyperbolic cosine function is defined as:

cosh(x) = (e^x + e^(-x)) / 2

where e is the Euler's number.

The input tensor x can be of any shape, and the function returns a tensor of the same shape as the input tensor.

The tensorflow.raw_ops.Cosh() function can be useful in implementing neural network models that include the hyperbolic cosine activation function.