Python – tensorflow.raw_ops.Cosh()

TensorFlow es una biblioteca de Python de código abierto diseñada por Google para desarrollar modelos de aprendizaje automático y redes neuronales de aprendizaje profundo. TensorFlow raw_ops proporciona acceso de bajo nivel a todas las operaciones de TensorFlow. Cosh() se usa para encontrar el coseno hiperbólico de x como elemento.

Sintaxis: tf.raw_ops.Cosh(x, nombre)

Parámetros: 

  • x: Es el tensor de entrada. Los dtype permitidos para este tensor son bfloat16, half, float32, float64. 
  • name(opcional): Define el nombre de la operación.
     

Devoluciones:  Devuelve un tensor del mismo tipo que x.
 

Nota: Solo toma argumentos de palabras clave.

Ejemplo 1:

Python3

# Importing the library
import tensorflow as tf
  
# Initializing the input tensor
a = tf.constant([1, 2, 3, 4, 5], dtype = tf.float64)
  
# Printing the input tensor
print('Input: ', a)
  
# Calculating hyperbolic cosine
res = tf.raw_ops.Cosh(x = a)
  
# Printing the result
print('Result: ', res)

Producción:

Input:  tf.Tensor([1. 2. 3. 4. 5.], shape=(5, ), dtype=float64)
Result:  tf.Tensor([ 1.54308063  3.76219569 10.067662   27.30823284 74.20994852], shape=(5, ), dtype=float64)


Ejemplo 2: Visualización

Python3

# importing the library
import tensorflow as tf
import matplotlib.pyplot as plt
  
# Initializing the input tensor
a = tf.constant([1, 2, 3, 4, 5], dtype = tf.float64)
  
# Calculating hyperbolic cosine
res = tf.raw_ops.Cosh(x = a)
  
# Plotting the graph
plt.plot(a, res, color ='green')
plt.title('tensorflow.raw_ops.Cosh')
plt.xlabel('Input')
plt.ylabel('Result')
plt.show()

Producción:

Publicación traducida automáticamente

Artículo escrito por aman neekhara y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *