función tensorflow.math.special.spence() en Python

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.

método fresnel_spence()

fresnel_spence() se utiliza para calcular la integral de x de Spence por elementos. Se define como la integral de log(t) / (1 – t) de 1 a x, con dominio de definición todos los números reales positivos.

Sintaxis: tensorflow.math.special.spence(x, nombre)

Parámetro:

  • x: Es un tensor o tensor disperso. Los dtypes permitidos son float32 y float64.
  • nombre (opcional): Define nombre para la operación.

Devoluciones: Devuelve un Tensor del mismo tipo que x.

Ejemplo 1:

Python3

# importing the library
import tensorflow as tf
 
# Initializing the input tensor
a = tf.constant([ [-5, -7],[ 2, 0]], dtype=tf.float64)
 
# Printing the input tensor
print('a: ', a)
 
# Calculating result
res = tf.math.special.spence(a)
 
# Printing the result
print('Result: ', res)

Producción:

a:  tf.Tensor(
[[-5. -7.]
 [ 2.  0.]], shape=(2, 2), dtype=float64)
Result:  tf.Tensor(
[[        nan         nan]
 [-0.82246703  1.64493407]], shape=(2, 2), dtype=float64)

Ejemplo 2:

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('a: ', a)
 
# Calculating result
res = tf.math.special.spence(a)
 
# Printing the result
print('Result: ', res)

Producción:

a: tf.Tensor([1. 2. 3. 4. 5.], forma=(5,), dtype=float64) 
Resultado: tf.Tensor([ 0. -0.82246703 -1.43674637 -1.93937542 -2.3699398 ], forma =(5,), dtipo=flotante64) 
 

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 *